Skip to content

Commit 4e76ae4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6: [PARISC] Convert to new irq_chip functions [PARISC] fix per-cpu flag problem in the cpu affinity checkers [PARISC] fix vmap flush/invalidate eliminate special FLUSH flag from page table parisc: flush pages through tmpalias space
2 parents f19ade4 + 1c0f647 commit 4e76ae4

13 files changed

Lines changed: 375 additions & 427 deletions

File tree

‎arch/parisc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config PARISC
1515
select HAVE_GENERIC_HARDIRQS
1616
select GENERIC_IRQ_PROBE
1717
select IRQ_PER_CPU
18+
select GENERIC_HARDIRQS_NO_DEPRECATED
1819

1920
help
2021
The PA-RISC microprocessor is designed by Hewlett-Packard and used

‎arch/parisc/include/asm/cacheflush.h‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ void flush_user_dcache_range_asm(unsigned long, unsigned long);
2626
void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
2727
void flush_kernel_dcache_page_asm(void *);
2828
void flush_kernel_icache_page(void *);
29-
void flush_user_dcache_page(unsigned long);
30-
void flush_user_icache_page(unsigned long);
3129
void flush_user_dcache_range(unsigned long, unsigned long);
3230
void flush_user_icache_range(unsigned long, unsigned long);
3331

@@ -37,6 +35,13 @@ void flush_cache_all_local(void);
3735
void flush_cache_all(void);
3836
void flush_cache_mm(struct mm_struct *mm);
3937

38+
#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
39+
void flush_kernel_dcache_page_addr(void *addr);
40+
static inline void flush_kernel_dcache_page(struct page *page)
41+
{
42+
flush_kernel_dcache_page_addr(page_address(page));
43+
}
44+
4045
#define flush_kernel_dcache_range(start,size) \
4146
flush_kernel_dcache_range_asm((start), (start)+(size));
4247
/* vmap range flushes and invalidates. Architecturally, we don't need
@@ -50,6 +55,16 @@ static inline void flush_kernel_vmap_range(void *vaddr, int size)
5055
}
5156
static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
5257
{
58+
unsigned long start = (unsigned long)vaddr;
59+
void *cursor = vaddr;
60+
61+
for ( ; cursor < vaddr + size; cursor += PAGE_SIZE) {
62+
struct page *page = vmalloc_to_page(cursor);
63+
64+
if (test_and_clear_bit(PG_dcache_dirty, &page->flags))
65+
flush_kernel_dcache_page(page);
66+
}
67+
flush_kernel_dcache_range_asm(start, start + size);
5368
}
5469

5570
#define flush_cache_vmap(start, end) flush_cache_all()
@@ -90,19 +105,15 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned
90105
void flush_cache_range(struct vm_area_struct *vma,
91106
unsigned long start, unsigned long end);
92107

108+
/* defined in pacache.S exported in cache.c used by flush_anon_page */
109+
void flush_dcache_page_asm(unsigned long phys_addr, unsigned long vaddr);
110+
93111
#define ARCH_HAS_FLUSH_ANON_PAGE
94112
static inline void
95113
flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
96114
{
97115
if (PageAnon(page))
98-
flush_user_dcache_page(vmaddr);
99-
}
100-
101-
#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
102-
void flush_kernel_dcache_page_addr(void *addr);
103-
static inline void flush_kernel_dcache_page(struct page *page)
104-
{
105-
flush_kernel_dcache_page_addr(page_address(page));
116+
flush_dcache_page_asm(page_to_phys(page), vmaddr);
106117
}
107118

108119
#ifdef CONFIG_DEBUG_RODATA

‎arch/parisc/include/asm/irq.h‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,10 @@ static __inline__ int irq_canonicalize(int irq)
3232
}
3333

3434
struct irq_chip;
35+
struct irq_data;
3536

36-
/*
37-
* Some useful "we don't have to do anything here" handlers. Should
38-
* probably be provided by the generic code.
39-
*/
40-
void no_ack_irq(unsigned int irq);
41-
void no_end_irq(unsigned int irq);
42-
void cpu_ack_irq(unsigned int irq);
43-
void cpu_eoi_irq(unsigned int irq);
37+
void cpu_ack_irq(struct irq_data *d);
38+
void cpu_eoi_irq(struct irq_data *d);
4439

4540
extern int txn_alloc_irq(unsigned int nbits);
4641
extern int txn_claim_irq(int);
@@ -49,7 +44,7 @@ extern unsigned long txn_alloc_addr(unsigned int);
4944
extern unsigned long txn_affinity_addr(unsigned int irq, int cpu);
5045

5146
extern int cpu_claim_irq(unsigned int irq, struct irq_chip *, void *);
52-
extern int cpu_check_affinity(unsigned int irq, const struct cpumask *dest);
47+
extern int cpu_check_affinity(struct irq_data *d, const struct cpumask *dest);
5348

5449
/* soft power switch support (power.c) */
5550
extern struct tasklet_struct power_tasklet;

‎arch/parisc/include/asm/pgtable.h‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ struct vm_area_struct;
138138
#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */
139139
#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */
140140
#define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */
141-
#define _PAGE_FLUSH_BIT 21 /* (0x400) Software: translation valid */
142-
/* for cache flushing only */
141+
/* bit 21 was formerly the FLUSH bit but is now unused */
143142
#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */
144143

145144
/* N.B. The bits are defined in terms of a 32 bit word above, so the */
@@ -173,7 +172,6 @@ struct vm_area_struct;
173172
#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))
174173
#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
175174
#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
176-
#define _PAGE_FLUSH (1 << xlate_pabit(_PAGE_FLUSH_BIT))
177175
#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
178176
#define _PAGE_FILE (1 << xlate_pabit(_PAGE_FILE_BIT))
179177

@@ -213,7 +211,6 @@ struct vm_area_struct;
213211
#define PAGE_KERNEL_RO __pgprot(_PAGE_KERNEL & ~_PAGE_WRITE)
214212
#define PAGE_KERNEL_UNC __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
215213
#define PAGE_GATEWAY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_GATEWAY| _PAGE_READ)
216-
#define PAGE_FLUSH __pgprot(_PAGE_FLUSH)
217214

218215

219216
/*
@@ -261,7 +258,7 @@ extern unsigned long *empty_zero_page;
261258

262259
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
263260

264-
#define pte_none(x) ((pte_val(x) == 0) || (pte_val(x) & _PAGE_FLUSH))
261+
#define pte_none(x) (pte_val(x) == 0)
265262
#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
266263
#define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0)
267264

@@ -444,13 +441,10 @@ struct mm_struct;
444441
static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
445442
{
446443
pte_t old_pte;
447-
pte_t pte;
448444

449445
spin_lock(&pa_dbit_lock);
450-
pte = old_pte = *ptep;
451-
pte_val(pte) &= ~_PAGE_PRESENT;
452-
pte_val(pte) |= _PAGE_FLUSH;
453-
set_pte_at(mm,addr,ptep,pte);
446+
old_pte = *ptep;
447+
pte_clear(mm,addr,ptep);
454448
spin_unlock(&pa_dbit_lock);
455449

456450
return old_pte;

‎arch/parisc/kernel/cache.c‎

Lines changed: 17 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@
2727
#include <asm/pgalloc.h>
2828
#include <asm/processor.h>
2929
#include <asm/sections.h>
30+
#include <asm/shmparam.h>
3031

3132
int split_tlb __read_mostly;
3233
int dcache_stride __read_mostly;
3334
int icache_stride __read_mostly;
3435
EXPORT_SYMBOL(dcache_stride);
3536

37+
void flush_dcache_page_asm(unsigned long phys_addr, unsigned long vaddr);
38+
EXPORT_SYMBOL(flush_dcache_page_asm);
39+
void flush_icache_page_asm(unsigned long phys_addr, unsigned long vaddr);
40+
3641

3742
/* On some machines (e.g. ones with the Merced bus), there can be
3843
* only a single PxTLB broadcast at a time; this must be guaranteed
@@ -259,81 +264,13 @@ void disable_sr_hashing(void)
259264
panic("SpaceID hashing is still on!\n");
260265
}
261266

262-
/* Simple function to work out if we have an existing address translation
263-
* for a user space vma. */
264-
static inline int translation_exists(struct vm_area_struct *vma,
265-
unsigned long addr, unsigned long pfn)
266-
{
267-
pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
268-
pmd_t *pmd;
269-
pte_t pte;
270-
271-
if(pgd_none(*pgd))
272-
return 0;
273-
274-
pmd = pmd_offset(pgd, addr);
275-
if(pmd_none(*pmd) || pmd_bad(*pmd))
276-
return 0;
277-
278-
/* We cannot take the pte lock here: flush_cache_page is usually
279-
* called with pte lock already held. Whereas flush_dcache_page
280-
* takes flush_dcache_mmap_lock, which is lower in the hierarchy:
281-
* the vma itself is secure, but the pte might come or go racily.
282-
*/
283-
pte = *pte_offset_map(pmd, addr);
284-
/* But pte_unmap() does nothing on this architecture */
285-
286-
/* Filter out coincidental file entries and swap entries */
287-
if (!(pte_val(pte) & (_PAGE_FLUSH|_PAGE_PRESENT)))
288-
return 0;
289-
290-
return pte_pfn(pte) == pfn;
291-
}
292-
293-
/* Private function to flush a page from the cache of a non-current
294-
* process. cr25 contains the Page Directory of the current user
295-
* process; we're going to hijack both it and the user space %sr3 to
296-
* temporarily make the non-current process current. We have to do
297-
* this because cache flushing may cause a non-access tlb miss which
298-
* the handlers have to fill in from the pgd of the non-current
299-
* process. */
300267
static inline void
301-
flush_user_cache_page_non_current(struct vm_area_struct *vma,
302-
unsigned long vmaddr)
268+
__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
269+
unsigned long physaddr)
303270
{
304-
/* save the current process space and pgd */
305-
unsigned long space = mfsp(3), pgd = mfctl(25);
306-
307-
/* we don't mind taking interrupts since they may not
308-
* do anything with user space, but we can't
309-
* be preempted here */
310-
preempt_disable();
311-
312-
/* make us current */
313-
mtctl(__pa(vma->vm_mm->pgd), 25);
314-
mtsp(vma->vm_mm->context, 3);
315-
316-
flush_user_dcache_page(vmaddr);
317-
if(vma->vm_flags & VM_EXEC)
318-
flush_user_icache_page(vmaddr);
319-
320-
/* put the old current process back */
321-
mtsp(space, 3);
322-
mtctl(pgd, 25);
323-
preempt_enable();
324-
}
325-
326-
327-
static inline void
328-
__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
329-
{
330-
if (likely(vma->vm_mm->context == mfsp(3))) {
331-
flush_user_dcache_page(vmaddr);
332-
if (vma->vm_flags & VM_EXEC)
333-
flush_user_icache_page(vmaddr);
334-
} else {
335-
flush_user_cache_page_non_current(vma, vmaddr);
336-
}
271+
flush_dcache_page_asm(physaddr, vmaddr);
272+
if (vma->vm_flags & VM_EXEC)
273+
flush_icache_page_asm(physaddr, vmaddr);
337274
}
338275

339276
void flush_dcache_page(struct page *page)
@@ -342,10 +279,8 @@ void flush_dcache_page(struct page *page)
342279
struct vm_area_struct *mpnt;
343280
struct prio_tree_iter iter;
344281
unsigned long offset;
345-
unsigned long addr;
282+
unsigned long addr, old_addr = 0;
346283
pgoff_t pgoff;
347-
unsigned long pfn = page_to_pfn(page);
348-
349284

350285
if (mapping && !mapping_mapped(mapping)) {
351286
set_bit(PG_dcache_dirty, &page->flags);
@@ -369,20 +304,11 @@ void flush_dcache_page(struct page *page)
369304
offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
370305
addr = mpnt->vm_start + offset;
371306

372-
/* Flush instructions produce non access tlb misses.
373-
* On PA, we nullify these instructions rather than
374-
* taking a page fault if the pte doesn't exist.
375-
* This is just for speed. If the page translation
376-
* isn't there, there's no point exciting the
377-
* nadtlb handler into a nullification frenzy.
378-
*
379-
* Make sure we really have this page: the private
380-
* mappings may cover this area but have COW'd this
381-
* particular page.
382-
*/
383-
if (translation_exists(mpnt, addr, pfn)) {
384-
__flush_cache_page(mpnt, addr);
385-
break;
307+
if (old_addr == 0 || (old_addr & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
308+
__flush_cache_page(mpnt, addr, page_to_phys(page));
309+
if (old_addr)
310+
printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? mpnt->vm_file->f_path.dentry->d_name.name : "(null)");
311+
old_addr = addr;
386312
}
387313
}
388314
flush_dcache_mmap_unlock(mapping);
@@ -573,7 +499,6 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
573499
{
574500
BUG_ON(!vma->vm_mm->context);
575501

576-
if (likely(translation_exists(vma, vmaddr, pfn)))
577-
__flush_cache_page(vma, vmaddr);
502+
__flush_cache_page(vma, vmaddr, page_to_phys(pfn_to_page(pfn)));
578503

579504
}

0 commit comments

Comments
 (0)