[GIT PULL] m32r: Fixes for v2.6.32-rc1

From: Hirokazu Takata
Date: Sun Oct 04 2009 - 00:03:41 EST


Hi Linus,

These fixes are required for v2.6.32-rc1 m32r kernel.

The mainline m32r SMP kernel has been disordered since v2.6.27,
but it will be remedied by the patchset.

Some of these modifications have already been locally applied and tested
for more than several weeks, it looks very stable.

Please pull the following updates from:
git://www.linux-m32r.org/git/takata/linux-2.6_dev.git for-linus

-- Takata

---
The following changes since commit 17d857be649a21ca90008c6dc425d849fa83db5c:
Linus Torvalds (1):
Linux 2.6.32-rc1

are available in the git repository at:

git://www.linux-m32r.org/git/takata/linux-2.6_dev.git for-linus

Hirokazu Takata (5):
m32r: fix tme_handler
m32r: export delay loop symbols
m32r: define ioread* and iowrite* macros
m32r: add rtc_lock variable
m32r: Fix set_memory() for DISCONTIGMEM

Toshihiro HANAWA (1):
m32r: Fix IPI function calls for SMP

arch/m32r/include/asm/io.h | 7 +++++++
arch/m32r/kernel/m32r_ksyms.c | 6 ------
arch/m32r/kernel/time.c | 9 +++++++++
arch/m32r/kernel/traps.c | 4 ++--
arch/m32r/lib/delay.c | 4 ++++
arch/m32r/mm/discontig.c | 5 ++++-
arch/m32r/mm/mmu.S | 12 ++++++++----
7 files changed, 34 insertions(+), 13 deletions(-)
---

commit 0a3d31b79e7fa600108e699805e2b2f9ea1f3194
Author: Toshihiro HANAWA <hanawa@xxxxxxxxxxxxxxxxx>
Date: Fri Oct 2 17:52:54 2009 +0900

m32r: Fix IPI function calls for SMP

This patch fixes the m32r SMP kernel after 2.6.27.

A part of the following patch breaks m32r SMP operation.
> m32r: convert to generic helpers for IPI function calls
> commit 7b7426c8a615cf61df9a77b9df7d5b75d91e3fa0

In the above patch, a CALL_FUNC_SINGLE_IPI was newly introduced,
but the its IPI vector number was wrong in the patch code.

The m32r SMP kernel hanged-up during boot operation, because
the CPU_BOOT_IPI was called instead of CALL_FUNC_SINGLE_IPI
(CPU_BOOT_IPI had no side effect at that time because the 2nd
core had already been started up),
as a result, csd_unlock() was not called, then a dead lock
occurred in csd_lock_wait() after the detection of Compact Flash
memory as IDE generic disk.

Signed-off-by: Toshihiro HANAWA <hanawa@xxxxxxxxxxxxxxxxx>
Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index 03b14e5..fbd1090 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -104,8 +104,8 @@ static void set_eit_vector_entries(void)
eit_vector[186] = (unsigned long)smp_call_function_interrupt;
eit_vector[187] = (unsigned long)smp_ipi_timer_interrupt;
eit_vector[188] = (unsigned long)smp_flush_cache_all_interrupt;
- eit_vector[189] = (unsigned long)smp_call_function_single_interrupt;
- eit_vector[190] = 0;
+ eit_vector[189] = 0; /* CPU_BOOT_IPI */
+ eit_vector[190] = (unsigned long)smp_call_function_single_interrupt;
eit_vector[191] = 0;
#endif
_flush_cache_copyback_all();

commit 6b6fabce5ac47668a2c2d9a14f1cdcc23c4ed896
Author: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Date: Wed Sep 23 21:37:06 2009 +0900

m32r: Fix set_memory() for DISCONTIGMEM

In case CONFIG_DISCONTIGMEM is set, the memory size of system was
always determined by CONFIG_MEMORY_SIZE and was not changeable.

This patch fixes set_memory() of arch/m32r/mm/discontig.c so that
we can specify memory size by the "mem=<size>" kernel parameter.

Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index b7a78ad..5d2858f 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -32,6 +32,9 @@ typedef struct {
} mem_prof_t;
static mem_prof_t mem_prof[MAX_NUMNODES];

+extern unsigned long memory_start;
+extern unsigned long memory_end;
+
static void __init mem_prof_init(void)
{
unsigned long start_pfn, holes, free_pfn;
@@ -42,7 +45,7 @@ static void __init mem_prof_init(void)
/* Node#0 SDRAM */
mp = &mem_prof[0];
mp->start_pfn = PFN_UP(CONFIG_MEMORY_START);
- mp->pages = PFN_DOWN(CONFIG_MEMORY_SIZE);
+ mp->pages = PFN_DOWN(memory_end - memory_start);
mp->holes = 0;
mp->free_pfn = PFN_UP(__pa(_end));


commit bac33bd571a9c2969efb52dd02c5407fbc49c360
Author: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Date: Wed Aug 26 13:13:12 2009 +0900

m32r: add rtc_lock variable

Add a spinlock variable "rtc_lock".
This is taken from arch/arm/kernel/time.c.

Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index ba61c4c..e7fee0f 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -33,6 +33,15 @@

#include <asm/hw_irq.h>

+#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
+/* this needs a better home */
+DEFINE_SPINLOCK(rtc_lock);
+
+#ifdef CONFIG_RTC_DRV_CMOS_MODULE
+EXPORT_SYMBOL(rtc_lock);
+#endif
+#endif /* pc-style 'CMOS' RTC support */
+
#ifdef CONFIG_SMP
extern void smp_local_timer_interrupt(void);
#endif

commit d2c5821c5de08175096f17166984d5e738cad024
Author: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Date: Wed Aug 26 13:04:33 2009 +0900

m32r: define ioread* and iowrite* macros

Define ioread* and iowrite* macros to fix the following build errors:

CC [M] drivers/uio/uio_smx.o
drivers/uio/uio_smx.c: In function 'smx_handler':
drivers/uio/uio_smx.c:31: error: implicit declaration of function 'ioread32'
drivers/uio/uio_smx.c:37: error: implicit declaration of function 'iowrite32'

Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index d06933b..4010f1f 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -162,6 +162,13 @@ static inline void _writel(unsigned long l, unsigned long addr)
#define __raw_writew writew
#define __raw_writel writel

+#define ioread8 read
+#define ioread16 readw
+#define ioread32 readl
+#define iowrite8 writeb
+#define iowrite16 writew
+#define iowrite32 writel
+
#define mmiowb()

#define flush_write_buffers() do { } while (0) /* M32R_FIXME */

commit ced0f005c7b0a7e751b2d15ea502a7654ddb3630
Author: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Date: Wed Aug 26 13:09:12 2009 +0900

m32r: export delay loop symbols

- Move EXPORT_SYMBOL lines of delay loop functions
from arch/m32r/kernel/m32r_ksyms.c to arch/m32r/lib/delay.c.
- Export __ndelay.

Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index 22624b5..7005707 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -23,12 +23,6 @@ EXPORT_SYMBOL(__ioremap);
EXPORT_SYMBOL(iounmap);
EXPORT_SYMBOL(kernel_thread);

-/* Networking helper routines. */
-/* Delay loops */
-EXPORT_SYMBOL(__udelay);
-EXPORT_SYMBOL(__delay);
-EXPORT_SYMBOL(__const_udelay);
-
EXPORT_SYMBOL(strncpy_from_user);
EXPORT_SYMBOL(__strncpy_from_user);
EXPORT_SYMBOL(clear_user);
diff --git a/arch/m32r/lib/delay.c b/arch/m32r/lib/delay.c
index ced549b..940f483 100644
--- a/arch/m32r/lib/delay.c
+++ b/arch/m32r/lib/delay.c
@@ -122,4 +122,8 @@ void __ndelay(unsigned long nsecs)
{
__const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
}
+
+EXPORT_SYMBOL(__delay);
+EXPORT_SYMBOL(__const_udelay);
+EXPORT_SYMBOL(__udelay);
EXPORT_SYMBOL(__ndelay);

commit 2cff5e1a83c61613febf814640dc877b98d585e6
Author: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Date: Tue Aug 11 23:12:41 2009 +0900

m32r: fix tme_handler

Fix pmd_bad check code of tme_handler (TLB Miss Exception handler).
The correct _KERNPG_TABLE value is not 0x263(=611) but 0x163.

Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>

diff --git a/arch/m32r/mm/mmu.S b/arch/m32r/mm/mmu.S
index 49a6d16..e9491a5 100644
--- a/arch/m32r/mm/mmu.S
+++ b/arch/m32r/mm/mmu.S
@@ -150,9 +150,13 @@ ENTRY(tme_handler)

; pmd = pmd_offset(pgd, address);
ld r3, @r3 ; r3: pmd data
- ldi r2, #-4096
beqz r3, 3f ; pmd_none(*pmd) ?

+ and3 r2, r3, #0xfff
+ add3 r2, r2, #-355 ; _KERNPG_TABLE(=0x163)
+ bnez r2, 3f ; pmd_bad(*pmd) ?
+ ldi r2, #-4096
+
; pte = pte_offset(pmd, address);
and r2, r3 ; r2: pte base addr
srl3 r3, r0, #10
@@ -263,9 +267,9 @@ ENTRY(tme_handler)
ld r1, @r3 ; r1: pmd
beqz r1, 3f ; pmd_none(*pmd) ?
;
- and3 r1, r1, #0xeff
- ldi r4, #611 ; _KERNPG_TABLE(=611)
- bne r1, r4, 3f ; !pmd_bad(*pmd) ?
+ and3 r1, r1, #0x3ff
+ ldi r4, #0x163 ; _KERNPG_TABLE(=0x163)
+ bne r1, r4, 3f ; pmd_bad(*pmd) ?

.fillinsn
4:
--
Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Linux/M32R Project: http://www.linux-m32r.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/