From 8039de10aae3cd4cf0ef0ccebd58aff0e8810df2 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Tue, 10 Jan 2006 20:35:03 -0500 Subject: [PARISC] Add __read_mostly section for parisc Flag a whole bunch of things as __read_mostly on parisc. Also flag a few branches as unlikely() and cleanup a bit of code. Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin --- arch/parisc/kernel/cache.c | 12 ++++++------ arch/parisc/kernel/drivers.c | 2 +- arch/parisc/kernel/firmware.c | 2 +- arch/parisc/kernel/inventory.c | 6 +++--- arch/parisc/kernel/pci-dma.c | 6 +++--- arch/parisc/kernel/pdc_chassis.c | 13 +++++++------ arch/parisc/kernel/perf.c | 6 +++--- arch/parisc/kernel/process.c | 2 +- arch/parisc/kernel/processor.c | 8 ++++---- arch/parisc/kernel/setup.c | 10 +++++----- arch/parisc/kernel/smp.c | 8 ++++---- arch/parisc/kernel/time.c | 4 ++-- arch/parisc/kernel/topology.c | 3 ++- arch/parisc/kernel/unaligned.c | 2 +- arch/parisc/kernel/unwind.c | 2 +- arch/parisc/kernel/vmlinux.lds.S | 4 ++++ arch/parisc/mm/init.c | 20 ++++++++++---------- 17 files changed, 58 insertions(+), 52 deletions(-) (limited to 'arch') diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index a065349aee37..63047c6d2d04 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -29,9 +29,9 @@ #include #include -int split_tlb; -int dcache_stride; -int icache_stride; +int split_tlb __read_mostly; +int dcache_stride __read_mostly; +int icache_stride __read_mostly; EXPORT_SYMBOL(dcache_stride); @@ -45,9 +45,9 @@ DEFINE_SPINLOCK(pa_tlb_lock); EXPORT_SYMBOL(pa_tlb_lock); #endif -struct pdc_cache_info cache_info; +struct pdc_cache_info cache_info __read_mostly; #ifndef CONFIG_PA20 -static struct pdc_btlb_info btlb_info; +static struct pdc_btlb_info btlb_info __read_mostly; #endif #ifdef CONFIG_SMP @@ -332,7 +332,7 @@ void clear_user_page_asm(void *page, unsigned long vaddr) } #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ -int parisc_cache_flush_threshold = FLUSH_THRESHOLD; +int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD; void parisc_setup_cache_timing(void) { diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index d016d672ec2b..041524d24ef1 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -39,7 +39,7 @@ #include /* See comments in include/asm-parisc/pci.h */ -struct hppa_dma_ops *hppa_dma_ops; +struct hppa_dma_ops *hppa_dma_ops __read_mostly; EXPORT_SYMBOL(hppa_dma_ops); static struct device root = { diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c index 553f8fe03224..2dc06b8e1817 100644 --- a/arch/parisc/kernel/firmware.c +++ b/arch/parisc/kernel/firmware.c @@ -80,7 +80,7 @@ static unsigned long pdc_result2[32] __attribute__ ((aligned (8))); /* Firmware needs to be initially set to narrow to determine the * actual firmware width. */ -int parisc_narrow_firmware = 1; +int parisc_narrow_firmware __read_mostly = 1; #endif /* On most currently-supported platforms, IODC I/O calls are 32-bit calls diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c index 8f563871e83c..4e847ba53180 100644 --- a/arch/parisc/kernel/inventory.c +++ b/arch/parisc/kernel/inventory.c @@ -38,7 +38,7 @@ */ #undef DEBUG_PAT -int pdc_type = PDC_TYPE_ILLEGAL; +int pdc_type __read_mostly = PDC_TYPE_ILLEGAL; void __init setup_pdc(void) { @@ -120,8 +120,8 @@ set_pmem_entry(physmem_range_t *pmem_ptr, unsigned long start, * pdc info is bad in this case). */ - if ( ((start & (PAGE_SIZE - 1)) != 0) - || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) ) { + if (unlikely( ((start & (PAGE_SIZE - 1)) != 0) + || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) )) { panic("Memory range doesn't align with page size!\n"); } diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c index f94a02ef3d95..a6caf1073085 100644 --- a/arch/parisc/kernel/pci-dma.c +++ b/arch/parisc/kernel/pci-dma.c @@ -33,10 +33,10 @@ #include #include /* for purge_tlb_*() macros */ -static struct proc_dir_entry * proc_gsc_root = NULL; +static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length); -static unsigned long pcxl_used_bytes = 0; -static unsigned long pcxl_used_pages = 0; +static unsigned long pcxl_used_bytes __read_mostly = 0; +static unsigned long pcxl_used_pages __read_mostly = 0; extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */ static spinlock_t pcxl_res_lock; diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c index 52004ae28d20..2a01fe1bdc98 100644 --- a/arch/parisc/kernel/pdc_chassis.c +++ b/arch/parisc/kernel/pdc_chassis.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -38,8 +39,8 @@ #ifdef CONFIG_PDC_CHASSIS -static int pdc_chassis_old = 0; -static unsigned int pdc_chassis_enabled = 1; +static int pdc_chassis_old __read_mostly = 0; +static unsigned int pdc_chassis_enabled __read_mostly = 1; /** @@ -132,7 +133,7 @@ void __init parisc_pdc_chassis_init(void) { #ifdef CONFIG_PDC_CHASSIS int handle = 0; - if (pdc_chassis_enabled) { + if (likely(pdc_chassis_enabled)) { DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__); /* Let see if we have something to handle... */ @@ -142,7 +143,7 @@ void __init parisc_pdc_chassis_init(void) printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n"); handle = 1; } - else if (pdc_chassis_old) { + else if (unlikely(pdc_chassis_old)) { printk(KERN_INFO "Enabling old style chassis LED panel support.\n"); handle = 1; } @@ -178,7 +179,7 @@ int pdc_chassis_send_status(int message) /* Maybe we should do that in an other way ? */ int retval = 0; #ifdef CONFIG_PDC_CHASSIS - if (pdc_chassis_enabled) { + if (likely(pdc_chassis_enabled)) { DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message); @@ -214,7 +215,7 @@ int pdc_chassis_send_status(int message) } } else retval = -1; #else - if (pdc_chassis_old) { + if (unlikely(pdc_chassis_old)) { switch (message) { case PDC_CHASSIS_DIRECT_BSTART: case PDC_CHASSIS_DIRECT_BCOMPLETE: diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c index f6fec62b6a2f..79dcbcccecb8 100644 --- a/arch/parisc/kernel/perf.c +++ b/arch/parisc/kernel/perf.c @@ -66,10 +66,10 @@ struct rdr_tbl_ent { uint8_t write_control; }; -static int perf_processor_interface = UNKNOWN_INTF; -static int perf_enabled = 0; +static int perf_processor_interface __read_mostly = UNKNOWN_INTF; +static int perf_enabled __read_mostly = 0; static spinlock_t perf_lock; -struct parisc_device *cpu_device = NULL; +struct parisc_device *cpu_device __read_mostly = NULL; /* RDRs to write for PCX-W */ static int perf_rdrs_W[] = diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index fee4f1f09adc..4eb70a40ec7e 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -54,7 +54,7 @@ #include #include -static int hlt_counter; +static int hlt_counter __read_mostly; /* * Power off function, if any diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c index 4f5bbcf1f5a4..6df9f62cecb5 100644 --- a/arch/parisc/kernel/processor.c +++ b/arch/parisc/kernel/processor.c @@ -44,10 +44,10 @@ #include /* for struct irq_region */ #include -struct system_cpuinfo_parisc boot_cpu_data; +struct system_cpuinfo_parisc boot_cpu_data __read_mostly; EXPORT_SYMBOL(boot_cpu_data); -struct cpuinfo_parisc cpu_data[NR_CPUS]; +struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly; /* ** PARISC CPU driver - claim "device" and initialize CPU data structures. @@ -378,12 +378,12 @@ show_cpuinfo (struct seq_file *m, void *v) return 0; } -static struct parisc_device_id processor_tbl[] = { +static struct parisc_device_id processor_tbl[] __read_mostly = { { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID }, { 0, } }; -static struct parisc_driver cpu_driver = { +static struct parisc_driver cpu_driver __read_mostly = { .name = "CPU", .id_table = processor_tbl, .probe = processor_probe diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c index 73e9c34b0948..4a36ec3f6ac1 100644 --- a/arch/parisc/kernel/setup.c +++ b/arch/parisc/kernel/setup.c @@ -46,15 +46,15 @@ #include #include -char command_line[COMMAND_LINE_SIZE]; +char command_line[COMMAND_LINE_SIZE] __read_mostly; /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */ -struct proc_dir_entry * proc_runway_root = NULL; -struct proc_dir_entry * proc_gsc_root = NULL; -struct proc_dir_entry * proc_mckinley_root = NULL; +struct proc_dir_entry * proc_runway_root __read_mostly = NULL; +struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; +struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL; #if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA)) -int parisc_bus_is_phys = 1; /* Assume no IOMMU is present */ +int parisc_bus_is_phys __read_mostly = 1; /* Assume no IOMMU is present */ EXPORT_SYMBOL(parisc_bus_is_phys); #endif diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index ce89da0f654d..fb3ca84f1b97 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -58,9 +58,9 @@ DEFINE_SPINLOCK(smp_lock); volatile struct task_struct *smp_init_current_idle_task; -static volatile int cpu_now_booting = 0; /* track which CPU is booting */ +static volatile int cpu_now_booting __read_mostly = 0; /* track which CPU is booting */ -static int parisc_max_cpus = 1; +static int parisc_max_cpus __read_mostly = 1; /* online cpus are ones that we've managed to bring up completely * possible cpus are all valid cpu @@ -71,8 +71,8 @@ static int parisc_max_cpus = 1; * empty in the beginning. */ -cpumask_t cpu_online_map = CPU_MASK_NONE; /* Bitmap of online CPUs */ -cpumask_t cpu_possible_map = CPU_MASK_ALL; /* Bitmap of Present CPUs */ +cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; /* Bitmap of online CPUs */ +cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CPUs */ EXPORT_SYMBOL(cpu_online_map); EXPORT_SYMBOL(cpu_possible_map); diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index cded25680787..594930bc4bcf 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c @@ -36,8 +36,8 @@ /* xtime and wall_jiffies keep wall-clock time */ extern unsigned long wall_jiffies; -static long clocktick; /* timer cycles per tick */ -static long halftick; +static long clocktick __read_mostly; /* timer cycles per tick */ +static long halftick __read_mostly; #ifdef CONFIG_SMP extern void smp_do_timer(struct pt_regs *regs); diff --git a/arch/parisc/kernel/topology.c b/arch/parisc/kernel/topology.c index ac2a40681414..3ba040050e4c 100644 --- a/arch/parisc/kernel/topology.c +++ b/arch/parisc/kernel/topology.c @@ -20,8 +20,9 @@ #include #include #include +#include -static struct cpu cpu_devices[NR_CPUS]; +static struct cpu cpu_devices[NR_CPUS] __read_mostly; static int __init topology_init(void) { diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c index eaae8a021f9f..de0a1b21cb40 100644 --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c @@ -122,7 +122,7 @@ #define ERR_NOTHANDLED -1 #define ERR_PAGEFAULT -2 -int unaligned_enabled = 1; +int unaligned_enabled __read_mostly = 1; void die_if_kernel (char *str, struct pt_regs *regs, long err); diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index db141108412e..cc1c1afc3187 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c @@ -35,7 +35,7 @@ static spinlock_t unwind_lock; * we can call unwind_init as early in the bootup process as * possible (before the slab allocator is initialized) */ -static struct unwind_table kernel_unwind_table; +static struct unwind_table kernel_unwind_table __read_mostly; static LIST_HEAD(unwind_tables); static inline const struct unwind_table_entry * diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index e5fac3e08c7a..b8b9174f6425 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -105,6 +105,10 @@ SECTIONS . = ALIGN(16); .data.lock_aligned : { *(.data.lock_aligned) } + /* rarely changed data like cpu maps */ + . = ALIGN(16); + .data.read_mostly : { *(.data.read_mostly) } + _edata = .; /* End of data section */ . = ALIGN(16384); /* init_task */ diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 29b998e430e6..a992cb8cfe61 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -36,9 +36,9 @@ extern char _end; /* end of BSS, defined by linker */ extern char __init_begin, __init_end; #ifdef CONFIG_DISCONTIGMEM -struct node_map_data node_data[MAX_NUMNODES]; -bootmem_data_t bmem_data[MAX_NUMNODES]; -unsigned char pfnnid_map[PFNNID_MAP_MAX]; +struct node_map_data node_data[MAX_NUMNODES] __read_mostly; +bootmem_data_t bmem_data[MAX_NUMNODES] __read_mostly; +unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; #endif static struct resource data_resource = { @@ -58,14 +58,14 @@ static struct resource pdcdata_resource = { .flags = IORESOURCE_BUSY | IORESOURCE_MEM, }; -static struct resource sysram_resources[MAX_PHYSMEM_RANGES]; +static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly; /* The following array is initialized from the firmware specific * information retrieved in kernel/inventory.c. */ -physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES]; -int npmem_ranges; +physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; +int npmem_ranges __read_mostly; #ifdef __LP64__ #define MAX_MEM (~0UL) @@ -73,7 +73,7 @@ int npmem_ranges; #define MAX_MEM (3584U*1024U*1024U) #endif /* !__LP64__ */ -static unsigned long mem_limit = MAX_MEM; +static unsigned long mem_limit __read_mostly = MAX_MEM; static void __init mem_limit_func(void) { @@ -431,11 +431,11 @@ void free_initmem(void) #define SET_MAP_OFFSET(x) ((void *)(((unsigned long)(x) + VM_MAP_OFFSET) \ & ~(VM_MAP_OFFSET-1))) -void *vmalloc_start; +void *vmalloc_start __read_mostly; EXPORT_SYMBOL(vmalloc_start); #ifdef CONFIG_PA11 -unsigned long pcxl_dma_start; +unsigned long pcxl_dma_start __read_mostly; #endif void __init mem_init(void) @@ -475,7 +475,7 @@ int do_check_pgt_cache(int low, int high) return 0; } -unsigned long *empty_zero_page; +unsigned long *empty_zero_page __read_mostly; void show_mem(void) { -- cgit v1.2.3 From 1b2425e3c79984975a1a3e6fa84512f23d96da9f Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 10 Jan 2006 20:47:49 -0500 Subject: [PARISC] Make local cache flushes take a void * Make flush_data_cache_local, flush_instruction_cache_local and flush_tlb_all_local take a void * so they don't have to be cast when using on_each_cpu(). This becomes a problem when on_each_cpu is a macro (as it is in current -mm). Also move the prototype of flush_tlb_all_local into tlbflush.h and remove its declaration from .c files. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- arch/parisc/kernel/cache.c | 8 ++++---- arch/parisc/kernel/smp.c | 8 +++----- arch/parisc/mm/init.c | 2 +- include/asm-parisc/cache.h | 8 ++++---- include/asm-parisc/tlbflush.h | 1 + 5 files changed, 13 insertions(+), 14 deletions(-) (limited to 'arch') diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 63047c6d2d04..d8a4ca021aac 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -54,20 +54,20 @@ static struct pdc_btlb_info btlb_info __read_mostly; void flush_data_cache(void) { - on_each_cpu((void (*)(void *))flush_data_cache_local, NULL, 1, 1); + on_each_cpu(flush_data_cache_local, NULL, 1, 1); } void flush_instruction_cache(void) { - on_each_cpu((void (*)(void *))flush_instruction_cache_local, NULL, 1, 1); + on_each_cpu(flush_instruction_cache_local, NULL, 1, 1); } #endif void flush_cache_all_local(void) { - flush_instruction_cache_local(); - flush_data_cache_local(); + flush_instruction_cache_local(NULL); + flush_data_cache_local(NULL); } EXPORT_SYMBOL(flush_cache_all_local); diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index fb3ca84f1b97..17f23c26f1ca 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -39,7 +39,7 @@ #include #include #include -#include /* for flush_tlb_all() proto/macro */ +#include #include #include /* for CPU_IRQ_REGION and friends */ @@ -406,12 +406,10 @@ EXPORT_SYMBOL(smp_call_function); * as we want to ensure all TLB's flushed before proceeding. */ -extern void flush_tlb_all_local(void); - void smp_flush_tlb_all(void) { - on_each_cpu((void (*)(void *))flush_tlb_all_local, NULL, 1, 1); + on_each_cpu(flush_tlb_all_local, NULL, 1, 1); } @@ -487,7 +485,7 @@ void __init smp_callin(void) #endif flush_cache_all_local(); /* start with known state */ - flush_tlb_all_local(); + flush_tlb_all_local(NULL); local_irq_enable(); /* Interrupts have been off until now */ diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index a992cb8cfe61..f2e7f13ddeeb 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -998,7 +998,7 @@ void flush_tlb_all(void) void flush_tlb_all(void) { spin_lock(&sid_lock); - flush_tlb_all_local(); + flush_tlb_all_local(NULL); recycle_sids(); spin_unlock(&sid_lock); } diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h index 38d201b5652d..93f179f13ce8 100644 --- a/include/asm-parisc/cache.h +++ b/include/asm-parisc/cache.h @@ -29,14 +29,14 @@ #define SMP_CACHE_BYTES L1_CACHE_BYTES -extern void flush_data_cache_local(void); /* flushes local data-cache only */ -extern void flush_instruction_cache_local(void); /* flushes local code-cache only */ +extern void flush_data_cache_local(void *); /* flushes local data-cache only */ +extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */ #ifdef CONFIG_SMP extern void flush_data_cache(void); /* flushes data-cache only (all processors) */ extern void flush_instruction_cache(void); /* flushes i-cache only (all processors) */ #else -#define flush_data_cache flush_data_cache_local -#define flush_instruction_cache flush_instruction_cache_local +#define flush_data_cache() flush_data_cache_local(NULL) +#define flush_instruction_cache() flush_instruction_cache_local(NULL) #endif extern void parisc_cache_init(void); /* initializes cache-flushing */ diff --git a/include/asm-parisc/tlbflush.h b/include/asm-parisc/tlbflush.h index c9ec39c6fc6c..825994a90e2d 100644 --- a/include/asm-parisc/tlbflush.h +++ b/include/asm-parisc/tlbflush.h @@ -22,6 +22,7 @@ extern spinlock_t pa_tlb_lock; #define purge_tlb_end(x) spin_unlock(&pa_tlb_lock) extern void flush_tlb_all(void); +extern void flush_tlb_all_local(void *); /* * flush_tlb_mm() -- cgit v1.2.3 From e0565a1c83a1045d8fae728056082262e712b201 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Tue, 10 Jan 2006 20:47:52 -0500 Subject: [PARISC] Fix and cleanup ioremap.c to work with 4level-fixup.h Fixup ioremap a bit. It seems to work on 32-bit kernels, but fails miserably on the first ioremapped access on 64-bit kernels. Also, having STI enabled causes it to fail. Probably because we're passing an ioremapped region to a real-mode STI call... Signed-off-by: Kyle McMartin --- arch/parisc/mm/ioremap.c | 100 +++++++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 37 deletions(-) (limited to 'arch') diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c index 5c7a1b3b9326..edd9a9559cba 100644 --- a/arch/parisc/mm/ioremap.c +++ b/arch/parisc/mm/ioremap.c @@ -1,12 +1,9 @@ /* * arch/parisc/mm/ioremap.c * - * Re-map IO memory to kernel address space so that we can access it. - * This is needed for high PCI addresses that aren't mapped in the - * 640k-1MB IO memory area on PC's - * * (C) Copyright 1995 1996 Linus Torvalds * (C) Copyright 2001 Helge Deller + * (C) Copyright 2005 Kyle McMartin */ #include @@ -14,81 +11,107 @@ #include #include #include +#include +#include -static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, - unsigned long phys_addr, unsigned long flags) +static inline void +remap_area_pte(pte_t *pte, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) { - unsigned long end; + unsigned long end, pfn; + pgprot_t pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | + _PAGE_ACCESSED | flags); address &= ~PMD_MASK; + end = address + size; if (end > PMD_SIZE) end = PMD_SIZE; - if (address >= end) - BUG(); + + BUG_ON(address >= end); + + pfn = phys_addr >> PAGE_SHIFT; do { - if (!pte_none(*pte)) { - printk(KERN_ERR "remap_area_pte: page already exists\n"); - BUG(); - } - set_pte(pte, mk_pte_phys(phys_addr, __pgprot(_PAGE_PRESENT | _PAGE_RW | - _PAGE_DIRTY | _PAGE_ACCESSED | flags))); + BUG_ON(!pte_none(*pte)); + + set_pte(pte, pfn_pte(pfn, pgprot)); + address += PAGE_SIZE; - phys_addr += PAGE_SIZE; + pfn++; pte++; } while (address && (address < end)); } -static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, - unsigned long phys_addr, unsigned long flags) +static inline int +remap_area_pmd(pmd_t *pmd, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) { unsigned long end; address &= ~PGDIR_MASK; + end = address + size; if (end > PGDIR_SIZE) end = PGDIR_SIZE; + + BUG_ON(address >= end); + phys_addr -= address; - if (address >= end) - BUG(); do { - pte_t * pte = pte_alloc_kernel(pmd, address); + pte_t *pte = pte_alloc_kernel(pmd, address); if (!pte) return -ENOMEM; - remap_area_pte(pte, address, end - address, address + phys_addr, flags); + + remap_area_pte(pte, address, end - address, + address + phys_addr, flags); + address = (address + PMD_SIZE) & PMD_MASK; pmd++; } while (address && (address < end)); + return 0; } -#if (USE_HPPA_IOREMAP) -static int remap_area_pages(unsigned long address, unsigned long phys_addr, - unsigned long size, unsigned long flags) +#if USE_HPPA_IOREMAP +static int +remap_area_pages(unsigned long address, unsigned long phys_addr, + unsigned long size, unsigned long flags) { - int error; - pgd_t * dir; + pgd_t *dir; + int error = 0; unsigned long end = address + size; + BUG_ON(address >= end); + phys_addr -= address; - dir = pgd_offset(&init_mm, address); + dir = pgd_offset_k(address); + flush_cache_all(); - if (address >= end) - BUG(); + do { + pud_t *pud; pmd_t *pmd; - pmd = pmd_alloc(&init_mm, dir, address); + error = -ENOMEM; + pud = pud_alloc(&init_mm, dir, address); + if (!pud) + break; + + pmd = pmd_alloc(&init_mm, pud, address); if (!pmd) break; + if (remap_area_pmd(pmd, address, end - address, - phys_addr + address, flags)) + phys_addr + address, flags)) break; + error = 0; address = (address + PGDIR_SIZE) & PGDIR_MASK; dir++; } while (address && (address < end)); + flush_tlb_all(); + return error; } #endif /* USE_HPPA_IOREMAP */ @@ -123,8 +146,7 @@ EXPORT_SYMBOL(__raw_bad_addr); /* * Remap an arbitrary physical address space into the kernel virtual - * address space. Needed when the kernel wants to access high addresses - * directly. + * address space. * * NOTE! We need to allow non-page-aligned mappings too: we will obviously * have to convert them into an offset in a page-aligned mapping, but the @@ -148,8 +170,8 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l #endif #else - void * addr; - struct vm_struct * area; + void *addr; + struct vm_struct *area; unsigned long offset, last_addr; /* Don't allow wraparound or zero size */ @@ -167,9 +189,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l t_addr = __va(phys_addr); t_end = t_addr + (size - 1); - for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++) + for (page = virt_to_page(t_addr); + page <= virt_to_page(t_end); page++) { if(!PageReserved(page)) return NULL; + } } /* @@ -185,11 +209,13 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l area = get_vm_area(size, VM_IOREMAP); if (!area) return NULL; + addr = area->addr; if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vfree(addr); return NULL; } + return (void __iomem *) (offset + (char *)addr); #endif } -- cgit v1.2.3 From a01c8cb126cb5f5a592f01b08ff8859508c75ba1 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 10 Jan 2006 20:47:53 -0500 Subject: [PARISC] Fix GSC graphics cards with 64MB regions Make knapps work with its 64MB gfx card. I probably just broke another machine in the process, but assuming 64MB when 64MB aligned is probably safer than assuming 32MB all the time. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- arch/parisc/kernel/drivers.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index 041524d24ef1..1eaa0d37f677 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -515,8 +515,13 @@ alloc_pa_dev(unsigned long hpa, struct hardware_path *mod_path) (iodc_data[5] << 8) | iodc_data[6]; dev->hpa.name = parisc_pathname(dev); dev->hpa.start = hpa; - if (hpa == 0xf4000000 || hpa == 0xf6000000 || - hpa == 0xf8000000 || hpa == 0xfa000000) { + /* This is awkward. The STI spec says that gfx devices may occupy + * 32MB or 64MB. Unfortunately, we don't know how to tell whether + * it's the former or the latter. Assumptions either way can hurt us. + */ + if (hpa == 0xf4000000 || hpa == 0xf8000000) { + dev->hpa.end = hpa + 0x03ffffff; + } else if (hpa == 0xf6000000 || hpa == 0xfa000000) { dev->hpa.end = hpa + 0x01ffffff; } else { dev->hpa.end = hpa + 0xfff; @@ -834,7 +839,7 @@ static void print_parisc_device(struct parisc_device *dev) if (dev->num_addrs) { int k; - printk(", additional addresses: "); + printk(", additional addresses: "); for (k = 0; k < dev->num_addrs; k++) printk("0x%lx ", dev->addr[k]); } -- cgit v1.2.3 From 5cdb8205e917c09fd1348e4b22e26492e8c45b36 Mon Sep 17 00:00:00 2001 From: Grant Grundler Date: Tue, 10 Jan 2006 20:47:57 -0500 Subject: [PARISC] Fix BLK_BOUNCE_HIGH on parisc by initializing max_low_pfn max_low_pfn was not being set in arch/parisc/mm/init.c, causing severe problems whenever anything tried to use BLK_BOUNCE_HIGH. Set it to max_pfn like other similar architectures do. Signed-off-by: Grant Grundler Signed-off-by: Kyle McMartin --- arch/parisc/mm/init.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch') diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index f2e7f13ddeeb..720287d46e55 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -300,6 +300,13 @@ static void __init setup_bootmem(void) max_pfn = start_pfn + npages; } + /* IOMMU is always used to access "high mem" on those boxes + * that can support enough mem that a PCI device couldn't + * directly DMA to any physical addresses. + * ISA DMA support will need to revisit this. + */ + max_low_pfn = max_pfn; + if ((bootmap_pfn - bootmap_start_pfn) != bootmap_pages) { printk(KERN_WARNING "WARNING! bootmap sizing is messed up!\n"); BUG(); -- cgit v1.2.3 From f45adcf977ac3c5512c17fd97b073bda99c81232 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 10 Jan 2006 20:48:06 -0500 Subject: [PARISC] Fix Dino reporting on J2240 Fix Dino reporting on J2240. This particular machine thought it had a Cujo. Also add J2240 Dino chip to the hp_hardware_list. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- arch/parisc/kernel/hardware.c | 1 + drivers/parisc/dino.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c index 2071b5bba15c..3058bffd8a2c 100644 --- a/arch/parisc/kernel/hardware.c +++ b/arch/parisc/kernel/hardware.c @@ -551,6 +551,7 @@ static struct hp_hardware hp_hardware_list[] __initdata = { {HPHW_BCPORT, 0x804, 0x0000C, 0x10, "REO I/O BC Merced Port"}, {HPHW_BCPORT, 0x782, 0x0000C, 0x00, "REO I/O BC Ropes Port"}, {HPHW_BCPORT, 0x784, 0x0000C, 0x00, "Pluto I/O BC Ropes Port"}, + {HPHW_BRIDGE, 0x05D, 0x0000A, 0x00, "SummitHawk Dino PCI Bridge"}, {HPHW_BRIDGE, 0x680, 0x0000A, 0x00, "Dino PCI Bridge"}, {HPHW_BRIDGE, 0x682, 0x0000A, 0x00, "Cujo PCI Bridge"}, {HPHW_BRIDGE, 0x782, 0x0000A, 0x00, "Elroy PCI Bridge"}, diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 45a1a494c1cc..216d1d859326 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -83,7 +83,8 @@ ** bus number for each dino. */ -#define is_card_dino(id) ((id)->hw_type == HPHW_A_DMA) +#define is_card_dino(id) ((id)->hw_type == HPHW_A_DMA) +#define is_cujo(id) ((id)->hversion == 0x682) #define DINO_IAR0 0x004 #define DINO_IODC_ADDR 0x008 @@ -682,7 +683,6 @@ dino_fixup_bus(struct pci_bus *bus) printk(KERN_WARNING "Device %s has unassigned IRQ\n", pci_name(dev)); #endif } else { - /* Adjust INT_LINE for that busses region */ dino_assign_irq(dino_dev, dev->irq, &dev->irq); } @@ -888,7 +888,7 @@ static int __init dino_common_init(struct parisc_device *dev, /* allocate I/O Port resource region */ res = &dino_dev->hba.io_space; - if (dev->id.hversion == 0x680 || is_card_dino(&dev->id)) { + if (!is_cujo(&dev->id)) { res->name = "Dino I/O Port"; } else { res->name = "Cujo I/O Port"; @@ -943,7 +943,7 @@ static int __init dino_probe(struct parisc_device *dev) if (is_card_dino(&dev->id)) { version = "3.x (card mode)"; } else { - if(dev->id.hversion == 0x680) { + if (!is_cujo(&dev->id)) { if (dev->id.hversion_rev < 4) { version = dino_vers[dev->id.hversion_rev]; } -- cgit v1.2.3 From 58b6c58caef7a34eab7ec887288fa495696653e7 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 10 Jan 2006 20:48:07 -0500 Subject: [PARISC] Use STABS_DEBUG macro from vmlinux.lds.h Cleanup vmlinux.lds.S by using STABS_DEBUG macro from vmlinux.lds.h instead of repeating the sections. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- arch/parisc/kernel/vmlinux.lds.S | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'arch') diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index b8b9174f6425..6d6436a6b624 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -68,7 +68,7 @@ SECTIONS RODATA /* writeable */ - . = ALIGN(4096); /* Make sure this is paged aligned so + . = ALIGN(4096); /* Make sure this is page aligned so that we can properly leave these as writable */ data_start = .; @@ -198,14 +198,7 @@ SECTIONS #endif } - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } + STABS_DEBUG .note 0 : { *(.note) } } -- cgit v1.2.3