Skip to content

Commit a377d18

Browse files
committed
Merge branch 'for-linus' of git://gitserver.sunplusct.com/linux-2.6-score
* 'for-linus' of git://gitserver.sunplusct.com/linux-2.6-score: score: include asm-generic/param.h in asm/delay.h. score: fixed pfn_valid define. score: add flush_dcahce_page and PG_dcache_dirty define
2 parents 22a8059 + ef8355c commit a377d18

6 files changed

Lines changed: 31 additions & 9 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ extern void flush_cache_sigtramp(unsigned long addr);
1414
extern void flush_icache_all(void);
1515
extern void flush_icache_range(unsigned long start, unsigned long end);
1616
extern void flush_dcache_range(unsigned long start, unsigned long end);
17+
extern void flush_dcache_page(struct page *page);
18+
19+
#define PG_dcache_dirty PG_arch_1
1720

1821
#define flush_cache_dup_mm(mm) do {} while (0)
1922
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
20-
#define flush_dcache_page(page) do {} while (0)
2123
#define flush_dcache_mmap_lock(mapping) do {} while (0)
2224
#define flush_dcache_mmap_unlock(mapping) do {} while (0)
2325
#define flush_cache_vmap(start, end) do {} while (0)

‎arch/score/include/asm/delay.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef _ASM_SCORE_DELAY_H
22
#define _ASM_SCORE_DELAY_H
33

4+
#include <asm-generic/param.h>
5+
46
static inline void __delay(unsigned long loops)
57
{
68
/* 3 cycles per loop. */

‎arch/score/include/asm/page.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern unsigned long max_pfn;
7474
#define page_to_bus(page) (page_to_phys(page))
7575
#define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr)))
7676

77-
#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_mapnr)
77+
#define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn))
7878

7979
#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
8080

‎arch/score/kernel/setup.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static void __init bootmem_init(void)
4949

5050
min_low_pfn = PFN_UP(MEMORY_START);
5151
max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE);
52+
max_mapnr = max_low_pfn - min_low_pfn;
5253

5354
/* Initialize the boot-time allocator with low memory only. */
5455
bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,

‎arch/score/mm/cache.c‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/mm.h>
3030
#include <linux/module.h>
3131
#include <linux/sched.h>
32+
#include <linux/fs.h>
3233

3334
#include <asm/mmu_context.h>
3435

@@ -51,6 +52,27 @@ static void flush_data_cache_page(unsigned long addr)
5152
}
5253
}
5354

55+
void flush_dcache_page(struct page *page)
56+
{
57+
struct address_space *mapping = page_mapping(page);
58+
unsigned long addr;
59+
60+
if (PageHighMem(page))
61+
return;
62+
if (mapping && !mapping_mapped(mapping)) {
63+
set_bit(PG_dcache_dirty, &(page)->flags);
64+
return;
65+
}
66+
67+
/*
68+
* We could delay the flush for the !page_mapping case too. But that
69+
* case is for exec env/arg pages and those are %99 certainly going to
70+
* get faulted into the tlb (and thus flushed) anyways.
71+
*/
72+
addr = (unsigned long) page_address(page);
73+
flush_data_cache_page(addr);
74+
}
75+
5476
/* called by update_mmu_cache. */
5577
void __update_cache(struct vm_area_struct *vma, unsigned long address,
5678
pte_t pte)
@@ -63,11 +85,11 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
6385
if (unlikely(!pfn_valid(pfn)))
6486
return;
6587
page = pfn_to_page(pfn);
66-
if (page_mapping(page) && test_bit(PG_arch_1, &page->flags)) {
88+
if (page_mapping(page) && test_bit(PG_dcache_dirty, &(page)->flags)) {
6789
addr = (unsigned long) page_address(page);
6890
if (exec)
6991
flush_data_cache_page(addr);
70-
clear_bit(PG_arch_1, &page->flags);
92+
clear_bit(PG_dcache_dirty, &(page)->flags);
7193
}
7294
}
7395

‎arch/score/mm/init.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ void __init mem_init(void)
8383
unsigned long codesize, reservedpages, datasize, initsize;
8484
unsigned long tmp, ram = 0;
8585

86-
max_mapnr = max_low_pfn;
8786
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
8887
totalram_pages += free_all_bootmem();
8988
totalram_pages -= setup_zero_page(); /* Setup zeroed pages. */
@@ -101,10 +100,6 @@ void __init mem_init(void)
101100
datasize = (unsigned long) &_edata - (unsigned long) &_etext;
102101
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
103102

104-
kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
105-
kclist_add(&kcore_vmalloc, (void *) VMALLOC_START,
106-
VMALLOC_END - VMALLOC_START);
107-
108103
printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
109104
"%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
110105
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10),

0 commit comments

Comments
 (0)