From afca03574555c9af9a86d5a025f0187d0b77ac32 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Mon, 15 Oct 2007 11:01:33 +0900 Subject: sh: Correct pte_page() breakage. As noted by David: pte_page() is a macro defined as follows; include/asm-sh/pgtable.h #define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) include/asm-sh/page.h #define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT)) So as you can see the phys_to_page() macro doesn't wrap the 'phys' parameter in parentheses so we end up with; pte_val(x)&PTE_PHYS_MASK >> PAGE_SHIFT Which is not what we wanted as '>>' has a higher precedence than bitwise AND. I dug into the git repository and I believe this bug was added with this commit (104b8deaa5c0144cccfc7d914413ff80c7176af1); 2006-03-27 KAMEZAWA Hiroyuki [PATCH] unify pfn_to_page: sh pfn_to_page -#define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT)) -#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START) +#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT)) +#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) Reported-by: David ADDISON Reported-by: KAMEZAWA Hiroyuki Signed-off-by: Paul Mundt --- include/asm-sh/page.h | 1 - include/asm-sh/pgtable.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index cb3d46c59ea..3aa8b07da47 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h @@ -128,7 +128,6 @@ typedef struct { unsigned long pgd; } pgd_t; #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT)) #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) /* PFN start number, because of __MEMORY_START */ diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index cf0dd2b648c..0b1d7c66565 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -399,7 +399,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) -#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) +#define pte_page(x) pfn_to_page(pte_pfn(x)) /* * The following only work if pte_present() is true. -- cgit v1.2.3 From 2278caa3c850c8f0aac4e1db7649a2c90cdaa9e9 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 30 Oct 2007 17:28:52 +0900 Subject: sh: Use generic SMP_CACHE_BYTES/L1_CACHE_ALIGN. Signed-off-by: Paul Mundt --- include/asm-sh/cache.h | 3 --- include/asm-sh/processor.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h index 7a18649d1cc..0fe7cf9a043 100644 --- a/include/asm-sh/cache.h +++ b/include/asm-sh/cache.h @@ -18,9 +18,6 @@ #define SH_CACHE_ASSOC 8 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) -#define SMP_CACHE_BYTES L1_CACHE_BYTES - -#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) #ifndef __ASSEMBLY__ struct cache_info { diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index 4f2922a1979..ab0028db645 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h @@ -71,7 +71,7 @@ struct sh_cpuinfo { struct cache_info scache; /* Secondary cache */ unsigned long flags; -} __attribute__ ((aligned(SMP_CACHE_BYTES))); +} __attribute__ ((aligned(L1_CACHE_BYTES))); extern struct sh_cpuinfo cpu_data[]; #define boot_cpu_data cpu_data[0] -- cgit v1.2.3 From 69d1ef4caf77da7164d3e392bf0a8057b42cf26e Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 30 Oct 2007 17:32:08 +0900 Subject: sh: Move zero page param defs somewhere sensible. Follows s390 and others. Signed-off-by: Paul Mundt --- include/asm-sh/setup.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/asm-sh/setup.h b/include/asm-sh/setup.h index 586a9711a75..55a2bd328d9 100644 --- a/include/asm-sh/setup.h +++ b/include/asm-sh/setup.h @@ -5,6 +5,20 @@ #ifdef __KERNEL__ +/* + * This is set up by the setup-routine at boot-time + */ +#define PARAM ((unsigned char *)empty_zero_page) + +#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) +#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) +#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) +#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) +#define INITRD_START (*(unsigned long *) (PARAM+0x010)) +#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) +/* ... */ +#define COMMAND_LINE ((char *) (PARAM+0x100)) + int setup_early_printk(char *); void sh_mv_setup(void); -- cgit v1.2.3 From 121fc47db6f4868890225e987447ee59a1e1c5b5 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 30 Oct 2007 17:39:07 +0900 Subject: sh: Provide a __read_mostly section wrapper. Signed-off-by: Paul Mundt --- include/asm-sh/cache.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h index 0fe7cf9a043..01e5cf51ba9 100644 --- a/include/asm-sh/cache.h +++ b/include/asm-sh/cache.h @@ -19,6 +19,8 @@ #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) +#define __read_mostly __attribute__((__section__(".data.read_mostly"))) + #ifndef __ASSEMBLY__ struct cache_info { unsigned int ways; /* Number of cache ways */ -- cgit v1.2.3 From 110ed28246a0063a5984d7f72ba5c97f154a51cf Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Fri, 2 Nov 2007 12:16:51 +0900 Subject: sh: Decouple 4k and soft/hardirq stacks. While using separate IRQ stacks can cut down on stack consumption, many users can also use 4k stacks directly without the additional need of separate stacks for soft and hardirqs. With this split, we support the same rationale for 4KSTACKS as m68knommu, with the IRQSTACKS abstraction as per ppc64. Signed-off-by: Paul Mundt --- include/asm-sh/irq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index c61d902b8bf..11850f65c92 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h @@ -41,7 +41,7 @@ static inline int generic_irq_demux(int irq) #define irq_canonicalize(irq) (irq) #define irq_demux(irq) sh_mv.mv_irq_demux(irq) -#ifdef CONFIG_4KSTACKS +#ifdef CONFIG_IRQSTACKS extern void irq_ctx_init(int cpu); extern void irq_ctx_exit(int cpu); # define __ARCH_HAS_DO_SOFTIRQ -- cgit v1.2.3