Re: [PATCH 1/2] m68k: Replace GPL 2.0+ README.legal boilerplate by SPDX

2023-09-07 Thread Greg Ungerer

Hi Geert,

On 8/9/23 00:21, Geert Uytterhoeven wrote:

Upstream Linux never had a "README.legal" file, but it was present
in early source releases of Linux/m68k.  It contained a simple copyright
notice and a link to a version of the "COPYING" file that predated the
addition of the "only valid GPL version is v2" clause.

Get rid of the references to non-existant files by replacing the
boilerplate with SPDX license identifiers.

Signed-off-by: Geert Uytterhoeven 
---
  arch/m68k/68000/entry.S | 7 ++-
  arch/m68k/bvme6000/config.c | 5 +
  arch/m68k/coldfire/entry.S  | 7 ++-
  arch/m68k/ifpsp060/Makefile | 6 ++
  arch/m68k/kernel/entry.S| 7 ++-
  arch/m68k/kernel/head.S | 8 ++--
  arch/m68k/mvme147/config.c  | 5 +
  arch/m68k/mvme16x/config.c  | 5 +
  arch/m68k/q40/config.c  | 5 +
  9 files changed, 14 insertions(+), 41 deletions(-)


Thank you for taking care of the ColdFire and 68000 ones as well!

Acked-by: Greg Ungerer 

Regards
Greg



diff --git a/arch/m68k/68000/entry.S b/arch/m68k/68000/entry.S
index 7d63e2f1555a03dc..72e95663b62ffd54 100644
--- a/arch/m68k/68000/entry.S
+++ b/arch/m68k/68000/entry.S
@@ -1,12 +1,9 @@
-/*
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ *
   *  entry.S -- non-mmu 68000 interrupt and exception entry points
   *
   *  Copyright (C) 1991, 1992  Linus Torvalds
   *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file README.legal in the main directory of this archive
- * for more details.
- *
   * Linux/m68k support by Hamish Macdonald
   */
  
diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c

index e604fe6602461334..8a2ee69a09f6659c 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /*
   *  arch/m68k/bvme6000/config.c
   *
@@ -8,10 +9,6 @@
   *  linux/amiga/config.c
   *
   *  Copyright (C) 1993 Hamish Macdonald
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file README.legal in the main directory of this archive
- * for more details.
   */
  
  #include 

diff --git a/arch/m68k/coldfire/entry.S b/arch/m68k/coldfire/entry.S
index 35104c5417ff4d07..4ea08336e2fb0aae 100644
--- a/arch/m68k/coldfire/entry.S
+++ b/arch/m68k/coldfire/entry.S
@@ -1,4 +1,5 @@
-/*
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ *
   *  entry.S  -- interrupt and exception processing for ColdFire
   *
   *  Copyright (C) 1999-2007, Greg Ungerer (g...@snapgear.com)
@@ -13,10 +14,6 @@
   *
   *  Copyright (C) 1991, 1992  Linus Torvalds
   *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file README.legal in the main directory of this archive
- * for more details.
- *
   * Linux/m68k support by Hamish Macdonald
   *
   * 68060 fixes by Jesper Skov
diff --git a/arch/m68k/ifpsp060/Makefile b/arch/m68k/ifpsp060/Makefile
index 56b530a96c2f33b5..00d0621f547ccb93 100644
--- a/arch/m68k/ifpsp060/Makefile
+++ b/arch/m68k/ifpsp060/Makefile
@@ -1,7 +1,5 @@
-# Makefile for 680x0 Linux 68060 integer/floating point support package
+# SPDX-License-Identifier: GPL-2.0-or-later
  #
-# This file is subject to the terms and conditions of the GNU General Public
-# License.  See the file "README.legal" in the main directory of this archive
-# for more details.
+# Makefile for 680x0 Linux 68060 integer/floating point support package
  
  obj-y := fskeleton.o iskeleton.o os.o

diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 4dd2fd7acba9ea07..3bcdd32a6b36613d 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -1,13 +1,10 @@
-/* -*- mode: asm -*-
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * -*- mode: asm -*-
   *
   *  linux/arch/m68k/kernel/entry.S
   *
   *  Copyright (C) 1991, 1992  Linus Torvalds
   *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file README.legal in the main directory of this archive
- * for more details.
- *
   * Linux/m68k support by Hamish Macdonald
   *
   * 68060 fixes by Jesper Skov
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 9e812d8606be8301..852255cf60dec132 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -1,4 +1,5 @@
-/* -*- mode: asm -*-
+/* SPDX-License-Identifier: GPL-2.0-or-later
+** -*- mode: asm -*-
  **
  ** head.S -- This file contains the initial boot code for the
  ** Linux/68k kernel.
@@ -25,11 +26,6 @@
  **for linux-2.1.115
  ** 1999/02/11  Richard Zidlicky: added Q40 support (initial version 99/01/01)
  ** 2004/05/13 Kars de Jong: Finalised HP300 support
-**
-** This file is subject to the terms and conditions of the GNU General Public
-** License. See the file README.legal in the main directory of this archive
-** for more details.
-**
  */
  
  /*

d

Re: [PATCH] treewide: drop CONFIG_EMBEDDED

2023-08-16 Thread Greg Ungerer



On 16/8/23 15:50, Randy Dunlap wrote:

There is only one Kconfig user of CONFIG_EMBEDDED and it can be
switched to EXPERT or "if !ARCH_MULTIPLATFORM" (suggested by Arnd).

Signed-off-by: Randy Dunlap 
Cc: Russell King 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Arnd Bergmann 
Cc: Jason A. Donenfeld 
Cc: wiregu...@lists.zx2c4.com
Cc: linux-a...@vger.kernel.org
Cc: linux-snps-...@lists.infradead.org
Cc: Vineet Gupta 
Cc: Brian Cain 
Cc: linux-hexa...@vger.kernel.org
Cc: Greg Ungerer 


Acked-by: Greg Ungerer 



Cc: Geert Uytterhoeven 
Cc: linux-m...@lists.linux-m68k.org
Cc: Michal Simek 
Cc: Thomas Bogendoerfer 
Cc: Dinh Nguyen 
Cc: Jonas Bonn 
Cc: Stefan Kristiansson 
Cc: Stafford Horne 
Cc: linux-openr...@vger.kernel.org
Cc: linux-m...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-ri...@lists.infradead.org
Cc: Paul Walmsley 
Cc: Palmer Dabbelt 
Cc: Albert Ou 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
Cc: linux...@vger.kernel.org
Cc: Max Filippov 
Cc: Josh Triplett 
Cc: Masahiro Yamada 
Cc: linux-kbu...@vger.kernel.org
Cc: Andrew Morton 
---
  arch/arc/configs/axs101_defconfig|2 +-
  arch/arc/configs/axs103_defconfig|2 +-
  arch/arc/configs/axs103_smp_defconfig|2 +-
  arch/arc/configs/haps_hs_smp_defconfig   |2 +-
  arch/arc/configs/hsdk_defconfig  |2 +-
  arch/arc/configs/nsim_700_defconfig  |2 +-
  arch/arc/configs/nsimosci_defconfig  |2 +-
  arch/arc/configs/nsimosci_hs_defconfig   |2 +-
  arch/arc/configs/tb10x_defconfig |2 +-
  arch/arc/configs/vdk_hs38_defconfig  |2 +-
  arch/arc/configs/vdk_hs38_smp_defconfig  |2 +-
  arch/arm/Kconfig |2 +-
  arch/arm/configs/aspeed_g4_defconfig |2 +-
  arch/arm/configs/aspeed_g5_defconfig |2 +-
  arch/arm/configs/at91_dt_defconfig   |2 +-
  arch/arm/configs/axm55xx_defconfig   |2 +-
  arch/arm/configs/bcm2835_defconfig   |2 +-
  arch/arm/configs/clps711x_defconfig  |2 +-
  arch/arm/configs/keystone_defconfig  |2 +-
  arch/arm/configs/lpc18xx_defconfig   |2 +-
  arch/arm/configs/lpc32xx_defconfig   |2 +-
  arch/arm/configs/milbeaut_m10v_defconfig |2 +-
  arch/arm/configs/moxart_defconfig|2 +-
  arch/arm/configs/multi_v4t_defconfig |2 +-
  arch/arm/configs/multi_v7_defconfig  |2 +-
  arch/arm/configs/pxa_defconfig   |2 +-
  arch/arm/configs/qcom_defconfig  |2 +-
  arch/arm/configs/sama5_defconfig |2 +-
  arch/arm/configs/sama7_defconfig |2 +-
  arch/arm/configs/socfpga_defconfig   |2 +-
  arch/arm/configs/stm32_defconfig |2 +-
  arch/arm/configs/tegra_defconfig |2 +-
  arch/arm/configs/vf610m4_defconfig   |2 +-
  arch/hexagon/configs/comet_defconfig |2 +-
  arch/m68k/configs/amcore_defconfig   |2 +-
  arch/m68k/configs/m5475evb_defconfig |2 +-
  arch/m68k/configs/stmark2_defconfig  |2 +-
  arch/microblaze/configs/mmu_defconfig|2 +-
  arch/mips/configs/ath25_defconfig|2 +-
  arch/mips/configs/ath79_defconfig|2 +-
  arch/mips/configs/bcm47xx_defconfig  |2 +-
  arch/mips/configs/ci20_defconfig |2 +-
  arch/mips/configs/cu1000-neo_defconfig   |2 +-
  arch/mips/configs/cu1830-neo_defconfig   |2 +-
  arch/mips/configs/db1xxx_defconfig   |2 +-
  arch/mips/configs/gcw0_defconfig |2 +-
  arch/mips/configs/generic_defconfig  |2 +-
  arch/mips/configs/loongson2k_defconfig   |2 +-
  arch/mips/configs/loongson3_defconfig|2 +-
  arch/mips/configs/malta_qemu_32r6_defconfig  |2 +-
  arch/mips/configs/maltaaprp_defconfig|2 +-
  arch/mips/configs/maltasmvp_defconfig|2 +-
  arch/mips/configs/maltasmvp_eva_defconfig|2 +-
  arch/mips/configs/maltaup_defconfig  |2 +-
  arch/mips/configs/omega2p_defconfig  |2 +-
  arch/mips/configs/pic32mzda_defconfig|2 +-
  arch/mips/configs/qi_lb60_defconfig  |2 +-
  arch/mips/configs/rs90_defconfig |2 +-
  arch/mips/configs/rt305x

Re: [PATCH 04/21] mm: free_area_init: use maximal zone PFNs rather than zone sizes

2020-06-15 Thread Greg Ungerer

Hi Mike,

On 15/6/20 4:22 pm, Mike Rapoport wrote:

On Mon, Jun 15, 2020 at 01:53:42PM +1000, Greg Ungerer wrote:

From: Mike Rapoport 

Currently, architectures that use free_area_init() to initialize memory map
and node and zone structures need to calculate zone and hole sizes. We can
use free_area_init_nodes() instead and let it detect the zone boundaries
while the architectures will only have to supply the possible limits for
the zones.

Signed-off-by: Mike Rapoport 


This is causing some new warnings for me on boot on at least one non-MMU m68k 
target:


There were a couple of changes that cause this. The free_area_init()
now relies on memblock data and architectural limits for zone sizes
rather than on explisit pfns calculated by the arch code. I've update
motorola variant and missed coldfire. Angelo sent a fix for mcfmmu.c
[1] and I've updated it to include nommu as well

[1] 
https://lore.kernel.org/linux-m68k/20200614225119.02-1-angelo.dureghe...@timesys.com


From 55b8523df2a5c4565b132c0691990f0821040fec Mon Sep 17 00:00:00 2001

From: Angelo Dureghello 
Date: Mon, 15 Jun 2020 00:51:19 +0200
Subject: [PATCH] m68k: fix registration of memory regions with memblock

Commit 3f08a302f533 ("mm: remove CONFIG_HAVE_MEMBLOCK_NODE_MAP option")
introduced assumption that UMA systems have their memory at node 0 and
updated most of them, but it forgot nommu and coldfire variants of m68k.

The later change in free area initialization in commit fa3354e4ea39 ("mm:
free_area_init: use maximal zone PFNs rather than zone sizes") exposed that
and caused a lot of "BUG: Bad page state in process swapper" reports.


Even with this patch applied I am still seeing the same messages.

Regards
Greg




Using memblock_add_node() with nid = 0 to register memory banks solves the
problem.

Fixes: 3f08a302f533 ("mm: remove CONFIG_HAVE_MEMBLOCK_NODE_MAP option")
Fixes: fa3354e4ea39 ("mm: free_area_init: use maximal zone PFNs rather than zone 
sizes")
Signed-off-by: Angelo Dureghello 
Co-developed-by: Mike Rapoport 
Signed-off-by: Mike Rapoport 
---
  arch/m68k/kernel/setup_no.c | 2 +-
  arch/m68k/mm/mcfmmu.c   | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index e779b19e0193..0c4589a39ba9 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -138,7 +138,7 @@ void __init setup_arch(char **cmdline_p)
pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ",
 __bss_stop, memory_start, memory_start, memory_end);
  
-	memblock_add(memory_start, memory_end - memory_start);

+   memblock_add_node(memory_start, memory_end - memory_start, 0);
  
  	/* Keep a copy of command line */

*cmdline_p = _line[0];
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
index 29f47923aa46..7d04210d34f0 100644
--- a/arch/m68k/mm/mcfmmu.c
+++ b/arch/m68k/mm/mcfmmu.c
@@ -174,7 +174,7 @@ void __init cf_bootmem_alloc(void)
m68k_memory[0].addr = _rambase;
m68k_memory[0].size = _ramend - _rambase;
  
-	memblock_add(m68k_memory[0].addr, m68k_memory[0].size);

+   memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0);
  
  	/* compute total pages in system */

num_pages = PFN_DOWN(_ramend - _rambase);



Re: [PATCH 04/21] mm: free_area_init: use maximal zone PFNs rather than zone sizes

2020-06-14 Thread Greg Ungerer

Hi Mike,

From: Mike Rapoport 

Currently, architectures that use free_area_init() to initialize memory map
and node and zone structures need to calculate zone and hole sizes. We can
use free_area_init_nodes() instead and let it detect the zone boundaries
while the architectures will only have to supply the possible limits for
the zones.

Signed-off-by: Mike Rapoport 


This is causing some new warnings for me on boot on at least one non-MMU m68k 
target:

...
NET: Registered protocol family 17
BUG: Bad page state in process swapper  pfn:20165
page:41fe0ca0 refcount:0 mapcount:1 mapping: index:0x0
flags: 0x0()
raw:  0100 0122     
page dumped because: nonzero mapcount
CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-1-g3a38f8a60c65-dirty #1
Stack from 404c9ebc:
404c9ebc 4029ab28 4029ab28 40088470 41fe0ca0 40299e21 40299df1 404ba2a4
00020165  41fd2c10 402c7ba0 41fd2c04 40088504 41fe0ca0 40299e21
 40088a12 41fe0ca0 41fe0ca4 020a  0001 402ca000
 41fe0ca0 41fd2c10 41fd2c10   402b2388 0001
400a0934 40091056 404c9f44 404c9f44 40088db4 402c7ba0 0001 41fd2c04
41fe0ca0 41fd2000 41fe0ca0 40089e02 4026ecf4 40089e4e 41fe0ca0 
Call Trace:
[<40088470>] 0x40088470
 [<40088504>] 0x40088504
 [<40088a12>] 0x40088a12
 [<402ca000>] 0x402ca000
 [<400a0934>] 0x400a0934

[<40091056>] 0x40091056
 [<40088db4>] 0x40088db4
 [<40089e02>] 0x40089e02
 [<4026ecf4>] 0x4026ecf4
 [<40089e4e>] 0x40089e4e

[<4008ca26>] 0x4008ca26
 [<4004adf8>] 0x4004adf8
 [<402701ec>] 0x402701ec
 [<4008f25e>] 0x4008f25e
 [<400516f4>] 0x400516f4

[<4026eec0>] 0x4026eec0
 [<400224f0>] 0x400224f0
 [<402ca000>] 0x402ca000
 [<4026eeda>] 0x4026eeda
 [<40020b00>] 0x40020b00
...

Lots more of them.

...
BUG: Bad page state in process swapper  pfn:201a0
page:41fe1400 refcount:0 mapcount:1 mapping: index:0x0
flags: 0x0()
raw:  0100 0122     
page dumped because: nonzero mapcount
CPU: 0 PID: 1 Comm: swapper Tainted: GB 
5.8.0-rc1-1-g3a38f8a60c65-dirty #1
Stack from 404c9ebc:
404c9ebc 4029ab28 4029ab28 40088470 41fe1400 40299e21 40299df1 404ba2a4
000201a0  41fd2c10 402c7ba0 41fd2c04 40088504 41fe1400 40299e21
 40088a12 41fe1400 41fe1404 020a 003b 0001 4034
 41fe1400 41fd2c10 41fd2c10   41fe13e0 40022826
0044 404c9f44 404c9f44 404c9f44 40088db4 402c7ba0 0001 41fd2c04
41fe1400 41fd2000 41fe1400 40089e02 4026ecf4 40089e4e 41fe1400 
Call Trace:
[<40088470>] 0x40088470
 [<40088504>] 0x40088504
 [<40088a12>] 0x40088a12
 [<40022826>] 0x40022826
 [<40088db4>] 0x40088db4

[<40089e02>] 0x40089e02
 [<4026ecf4>] 0x4026ecf4
 [<40089e4e>] 0x40089e4e
 [<4008ca26>] 0x4008ca26
 [<4004adf8>] 0x4004adf8

[<402701ec>] 0x402701ec
 [<4008f25e>] 0x4008f25e
 [<400516f4>] 0x400516f4
 [<4026eec0>] 0x4026eec0
 [<400224f0>] 0x400224f0

[<402ca000>] 0x402ca000
 [<4026eeda>] 0x4026eeda
 [<40020b00>] 0x40020b00
Freeing unused kernel memory: 648K
This architecture does not have kernel memory protection.
Run /init as init process
...

System boots pretty much as normal through user space after this.
Seems to be fully operational despite all those BUGONs.

Specifically this is a M5208EVB target (arch/m68k/configs/m5208evb).


[snip]

diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index b88d510d4fe3..6d3147662ff2 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -84,7 +84,7 @@ void __init paging_init(void)
 * page_alloc get different views of the world.
 */
unsigned long end_mem = memory_end & PAGE_MASK;
-   unsigned long zones_size[MAX_NR_ZONES] = { 0, };
+   unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0, };
 
 	high_memory = (void *) end_mem;
 
@@ -98,8 +98,8 @@ void __init paging_init(void)

 */
set_fs (USER_DS);
 
-	zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;

-   free_area_init(zones_size);
+   max_zone_pfn[ZONE_DMA] = end_mem >> PAGE_SHIFT;
+   free_area_init(max_zone_pfn);


This worries me a little. On this target PAGE_OFFSET will be non-0.

Thoughts?

Regards
Greg





Re: [PATCH 06/12] m68k/mm: move {cache,nocahe}_page() definitions close to their user

2020-05-13 Thread Greg Ungerer

Hi Mike,

On 13/5/20 4:44 am, Mike Rapoport wrote:

From: Mike Rapoport 

The cache_page() and nocache_page() functions are only used by the morotola

 
 motorola


MMU variant for setting caching attributes for the page table pages.

Move the definitions of these functions from
arch/m68k/include/asm/motorola_pgtable.h closer to their usage in
arch/m68k/mm/motorola.c and drop unused definition in
arch/m68k/include/asm/mcf_pgtable.h.

Signed-off-by: Mike Rapoport 


Acked-by: Greg Ungerer 

Regards
Greg



---
  arch/m68k/include/asm/mcf_pgtable.h  | 40 -
  arch/m68k/include/asm/motorola_pgtable.h | 44 
  arch/m68k/mm/motorola.c  | 43 +++
  3 files changed, 43 insertions(+), 84 deletions(-)

diff --git a/arch/m68k/include/asm/mcf_pgtable.h 
b/arch/m68k/include/asm/mcf_pgtable.h
index 0031cd387b75..737e826294f3 100644
--- a/arch/m68k/include/asm/mcf_pgtable.h
+++ b/arch/m68k/include/asm/mcf_pgtable.h
@@ -328,46 +328,6 @@ extern pgd_t kernel_pg_dir[PTRS_PER_PGD];
  #define pte_offset_kernel(dir, address) \
((pte_t *) __pmd_page(*(dir)) + __pte_offset(address))
  
-/*

- * Disable caching for page at given kernel virtual address.
- */
-static inline void nocache_page(void *vaddr)
-{
-   pgd_t *dir;
-   p4d_t *p4dp;
-   pud_t *pudp;
-   pmd_t *pmdp;
-   pte_t *ptep;
-   unsigned long addr = (unsigned long) vaddr;
-
-   dir = pgd_offset_k(addr);
-   p4dp = p4d_offset(dir, addr);
-   pudp = pud_offset(p4dp, addr);
-   pmdp = pmd_offset(pudp, addr);
-   ptep = pte_offset_kernel(pmdp, addr);
-   *ptep = pte_mknocache(*ptep);
-}
-
-/*
- * Enable caching for page at given kernel virtual address.
- */
-static inline void cache_page(void *vaddr)
-{
-   pgd_t *dir;
-   p4d_t *p4dp;
-   pud_t *pudp;
-   pmd_t *pmdp;
-   pte_t *ptep;
-   unsigned long addr = (unsigned long) vaddr;
-
-   dir = pgd_offset_k(addr);
-   p4dp = p4d_offset(dir, addr);
-   pudp = pud_offset(p4dp, addr);
-   pmdp = pmd_offset(pudp, addr);
-   ptep = pte_offset_kernel(pmdp, addr);
-   *ptep = pte_mkcache(*ptep);
-}
-
  /*
   * Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e))
   */
diff --git a/arch/m68k/include/asm/motorola_pgtable.h 
b/arch/m68k/include/asm/motorola_pgtable.h
index 9e5a3de21e15..e1594acf7c7e 100644
--- a/arch/m68k/include/asm/motorola_pgtable.h
+++ b/arch/m68k/include/asm/motorola_pgtable.h
@@ -227,50 +227,6 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmdp, 
unsigned long address)
  #define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> 
PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
  #define pte_unmap(pte)((void)0)
  
-/* Prior to calling these routines, the page should have been flushed

- * from both the cache and ATC, or the CPU might not notice that the
- * cache setting for the page has been changed. -jskov
- */
-static inline void nocache_page(void *vaddr)
-{
-   unsigned long addr = (unsigned long)vaddr;
-
-   if (CPU_IS_040_OR_060) {
-   pgd_t *dir;
-   p4d_t *p4dp;
-   pud_t *pudp;
-   pmd_t *pmdp;
-   pte_t *ptep;
-
-   dir = pgd_offset_k(addr);
-   p4dp = p4d_offset(dir, addr);
-   pudp = pud_offset(p4dp, addr);
-   pmdp = pmd_offset(pudp, addr);
-   ptep = pte_offset_kernel(pmdp, addr);
-   *ptep = pte_mknocache(*ptep);
-   }
-}
-
-static inline void cache_page(void *vaddr)
-{
-   unsigned long addr = (unsigned long)vaddr;
-
-   if (CPU_IS_040_OR_060) {
-   pgd_t *dir;
-   p4d_t *p4dp;
-   pud_t *pudp;
-   pmd_t *pmdp;
-   pte_t *ptep;
-
-   dir = pgd_offset_k(addr);
-   p4dp = p4d_offset(dir, addr);
-   pudp = pud_offset(p4dp, addr);
-   pmdp = pmd_offset(pudp, addr);
-   ptep = pte_offset_kernel(pmdp, addr);
-   *ptep = pte_mkcache(*ptep);
-   }
-}
-
  /* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) 
*/
  #define __swp_type(x) (((x).val >> 4) & 0xff)
  #define __swp_offset(x)   ((x).val >> 12)
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 904c2a663977..8e5e74121a78 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -45,6 +45,49 @@ unsigned long mm_cachebits;
  EXPORT_SYMBOL(mm_cachebits);
  #endif
  
+/* Prior to calling these routines, the page should have been flushed

+ * from both the cache and ATC, or the CPU might not notice that the
+ * cache setting for the page has been changed. -jskov
+ */
+s

Re: [PATCH 29/31] binfmt_flat: use flush_icache_user_range

2020-05-12 Thread Greg Ungerer

Hi Christoph,

On 10/5/20 5:55 pm, Christoph Hellwig wrote:

load_flat_file works on user addresses.

Signed-off-by: Christoph Hellwig 


Acked-by: Greg Ungerer 

Regards
Greg




---
  fs/binfmt_flat.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 831a2b25ba79f..6f0aca5379da2 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -854,7 +854,7 @@ static int load_flat_file(struct linux_binprm *bprm,
  #endif /* CONFIG_BINFMT_FLAT_OLD */
}
  
-	flush_icache_range(start_code, end_code);

+   flush_icache_user_range(start_code, end_code);
  
  	/* zero the BSS,  BRK and stack areas */

if (clear_user((void __user *)(datapos + data_len), bss_len +



Re: [PATCH 16/31] m68knommu: use asm-generic/cacheflush.h

2020-05-12 Thread Greg Ungerer

Hi Christoph,

On 10/5/20 5:54 pm, Christoph Hellwig wrote:

m68knommu needs almost no cache flushing routines of its own.  Rely on
asm-generic/cacheflush.h for the defaults.

Signed-off-by: Christoph Hellwig 


Acked-by: Greg Ungerer 

Regards
Greg



---
  arch/m68k/include/asm/cacheflush_no.h | 19 ++-
  1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/arch/m68k/include/asm/cacheflush_no.h 
b/arch/m68k/include/asm/cacheflush_no.h
index 11e9a9dcbfb24..2731f07e7be8c 100644
--- a/arch/m68k/include/asm/cacheflush_no.h
+++ b/arch/m68k/include/asm/cacheflush_no.h
@@ -9,25 +9,8 @@
  #include 
  
  #define flush_cache_all()			__flush_cache_all()

-#define flush_cache_mm(mm) do { } while (0)
-#define flush_cache_dup_mm(mm) do { } while (0)
-#define flush_cache_range(vma, start, end) do { } while (0)
-#define flush_cache_page(vma, vmaddr)  do { } while (0)
  #define flush_dcache_range(start, len)__flush_dcache_all()
-#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
-#define flush_dcache_page(page)do { } while (0)
-#define flush_dcache_mmap_lock(mapping)do { } while (0)
-#define flush_dcache_mmap_unlock(mapping)  do { } while (0)
  #define flush_icache_range(start, len)__flush_icache_all()
-#define flush_icache_page(vma,pg)  do { } while (0)
-#define flush_icache_user_range(vma,pg,adr,len)do { } while (0)
-#define flush_cache_vmap(start, end)   do { } while (0)
-#define flush_cache_vunmap(start, end) do { } while (0)
-
-#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
-   memcpy(dst, src, len)
-#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-   memcpy(dst, src, len)
  
  void mcf_cache_push(void);
  
@@ -98,4 +81,6 @@ static inline void cache_clear(unsigned long paddr, int len)

__clear_cache_all();
  }
  
+#include 

+
  #endif /* _M68KNOMMU_CACHEFLUSH_H */



Re: [PATCH 3/3] m68k: remove unused set_clock_mmss() helpers

2018-06-19 Thread Greg Ungerer

Hi Arnd,

On 19/06/18 00:05, Arnd Bergmann wrote:

Commit 397ac99c6cef ("m68k: remove dead timer code") removed set_rtc_mmss()
because it was unused in 2012. However, this was itself the only user of the
mach_set_clock_mmss() callback and the many implementations of that callback,
which are equally unused.

This removes all of those as well.

Signed-off-by: Arnd Bergmann 


This looks good to me:

Acked-by: Greg Ungerer 

Regards
Greg



---
  arch/m68k/apollo/config.c   |  8 --
  arch/m68k/atari/config.c|  5 
  arch/m68k/atari/time.c  | 63 -
  arch/m68k/bvme6000/config.c | 45 -
  arch/m68k/include/asm/machdep.h |  1 -
  arch/m68k/kernel/setup_mm.c |  1 -
  arch/m68k/kernel/setup_no.c |  1 -
  arch/m68k/mac/config.c  |  2 --
  arch/m68k/mac/misc.c| 16 ---
  arch/m68k/mvme147/config.c  |  7 -
  arch/m68k/mvme16x/config.c  |  8 --
  arch/m68k/q40/config.c  | 30 
  12 files changed, 187 deletions(-)

diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index b2a6bc63f8cd..aef8d42e078d 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -31,7 +31,6 @@ extern void dn_sched_init(irq_handler_t handler);
  extern void dn_init_IRQ(void);
  extern u32 dn_gettimeoffset(void);
  extern int dn_dummy_hwclk(int, struct rtc_time *);
-extern int dn_dummy_set_clock_mmss(unsigned long);
  extern void dn_dummy_reset(void);
  #ifdef CONFIG_HEARTBEAT
  static void dn_heartbeat(int on);
@@ -156,7 +155,6 @@ void __init config_apollo(void)
arch_gettimeoffset   = dn_gettimeoffset;
mach_max_dma_address = 0x;
mach_hwclk   = dn_dummy_hwclk; /* */
-   mach_set_clock_mmss  = dn_dummy_set_clock_mmss; /* */
mach_reset   = dn_dummy_reset;  /* */
  #ifdef CONFIG_HEARTBEAT
mach_heartbeat = dn_heartbeat;
@@ -240,12 +238,6 @@ int dn_dummy_hwclk(int op, struct rtc_time *t) {
  
  }
  
-int dn_dummy_set_clock_mmss(unsigned long nowtime)

-{
-   pr_info("set_clock_mmss\n");
-   return 0;
-}
-
  void dn_dummy_reset(void) {
  
dn_serial_print("The end !\n");

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 565c6f06ab0b..bd96702a1ad0 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -81,9 +81,6 @@ extern void atari_sched_init(irq_handler_t);
  extern u32 atari_gettimeoffset(void);
  extern int atari_mste_hwclk (int, struct rtc_time *);
  extern int atari_tt_hwclk (int, struct rtc_time *);
-extern int atari_mste_set_clock_mmss (unsigned long);
-extern int atari_tt_set_clock_mmss (unsigned long);
-
  
  /* ++roman: This is a more elaborate test for an SCC chip, since the plain

   * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
@@ -362,13 +359,11 @@ void __init config_atari(void)
ATARIHW_SET(TT_CLK);
pr_cont(" TT_CLK");
mach_hwclk = atari_tt_hwclk;
-   mach_set_clock_mmss = atari_tt_set_clock_mmss;
}
if (hwreg_present(_rtc.sec_ones)) {
ATARIHW_SET(MSTE_CLK);
pr_cont(" MSTE_CLK");
mach_hwclk = atari_mste_hwclk;
-   mach_set_clock_mmss = atari_mste_set_clock_mmss;
}
if (!MACH_IS_MEDUSA && hwreg_present(_wd.fdc_speed) &&
hwreg_write(_wd.fdc_speed, 0)) {
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index c549b48174ec..9cca64286464 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -285,69 +285,6 @@ int atari_tt_hwclk( int op, struct rtc_time *t )
  return( 0 );
  }
  
-

-int atari_mste_set_clock_mmss (unsigned long nowtime)
-{
-short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
-struct MSTE_RTC val;
-unsigned char rtc_minutes;
-
-mste_read();
-rtc_minutes= val.min_ones + val.min_tens * 10;
-if ((rtc_minutes < real_minutes
- ? real_minutes - rtc_minutes
- : rtc_minutes - real_minutes) < 30)
-{
-val.sec_ones = real_seconds % 10;
-val.sec_tens = real_seconds / 10;
-val.min_ones = real_minutes % 10;
-val.min_tens = real_minutes / 10;
-mste_write();
-}
-else
-return -1;
-return 0;
-}
-
-int atari_tt_set_clock_mmss (unsigned long nowtime)
-{
-int retval = 0;
-short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
-unsigned char save_control, save_freq_select, rtc_minutes;
-
-save_control = RTC_READ (RTC_CONTROL); /* tell the clock it's being set */
-RTC_WRITE (RTC_CONTROL, save_control | RTC_SET);
-
-save_freq_select = RTC_READ (RTC_FREQ_SELECT); /* stop and reset prescaler 
*/
-RTC_WRITE (RTC_FREQ_SELECT, save_freq_select | RTC_DIV_RESET2);
-
-rtc_m

Re: [m68k,powerpc,dma,ethernet,freescale RFA] Coldfire m54xx FEC ethernet driver

2012-10-24 Thread Greg Ungerer

Hi Philippe,

On 16/10/12 18:03, Philippe De Muyter wrote:

On Tue, Oct 16, 2012 at 04:39:05PM +1000, Greg Ungerer wrote:

On 09/10/12 19:07, Philippe De Muyter wrote:

[CCing lkml, linux-ppc, netdev, linux-m68k]

Hello kernel sources architects

I have a working driver for the m54xx FEC ethernet driver that I
would like to integrate in the kernel tree.  Problems are that
- this driver needs an associated DMA driver (provided by FreeScale)
wich is not dma-engine enabled
- they're are already many fec drivers in the kernel tree, and
at least one, fec_mpc52xx.c, seems to be very similar (information
below), to the one for the mcf54xx, except it uses a differently
named associated DMA driver (BestComm/SmartDma/SDMA) which is also
not dma-engine enabled, and even kept hidden in /arch/powerpc where
it is inaccessible when compiling for m68k.  The underlying DMA part
from Freescale however seems similar to the one used in the
m54xx. (again, see information below)

So, now I am lost, what should I do ?

The current state of my patches
[http://mailman.uclinux.org/pipermail/uclinux-dev/2012-September/052147.html]
is pushing the freescale provided MCD_DMA dma driver to /drivers/dma,
without adding the dma-engine compatibility layer, and adding the specific
fec_m54xx ethernet driver to /drivers/net/ethernet/freescale


Do you get any responses?
I didn't see any...


No, and none also about my simpler patch moving arch/powerpc/sysdev/bestcomm
to drivers/dma/bestcomm (except a private and useful one telling me how to
set '-M' option as default for 'git format-patch'), but at least this simpler
patch seems to be in a wait bucket at
http://patchwork.ozlabs.org/project/linuxppc-dev/list/.


Well, something useful then :-)

Feel free to send me the m68k header file updates as a patch (or patches
as appropriate), lets get those in now. They are worthwhile changes
on their own.

In light of no other other feedback you may want to push ahead then
with your patches to put the DMA engine code in drivers/dma. That
does seem like the right place to put it.

The new fec driver code should go to the netdev list for review.

Regards
Greg



Regards

Philippe

PS: -M as default for 'git format-patch':

put
[diff]
renames = true
in .git/config



Regards
Greg




On Tue, Oct 09, 2012 at 04:12:44PM +1000, Greg Ungerer wrote:

Hi Philippe,

On 05/10/12 01:03, Philippe De Muyter wrote:

On Thu, Oct 04, 2012 at 04:56:01PM +0200, Philippe De Muyter wrote:

On Thu, Oct 04, 2012 at 11:33:32PM +1000, Greg Ungerer wrote:


My biggest concern is the amount of MCD/DMA support code. And it is
all done quite differently to everything else in the kernel. We may
get a bit of push back from kernel folk who look after DMA.


Actually, there is already a similar code in
arch/powerpc/sysdev/bestcomm
(also from freescale, maybe an identical part, but I did not find any
usable doc), but the powerpc folks kept that hidden in the arch/powerpc
tree, instead of installing it in drivers/dma.


The MCD DMA or DMA FEC code from freescale has a comment implying that
this
was first used in the MPC8220 part.  And Montavista has a MPC8220 port,
but
I did not find it, so I do not know where they installed the MCD DMA
driver.


Ok, looks like there is a bit a variance in all this.


I also began to read the mpc5200 user's guide parts about the fec and
BestComm/SmartDma/SDMA (not sure which one is the official FreeScale name)
and they look very similar, but not identical, to their m54xx
counterparts.

It seems possible to make the fec_mpc52xx.c driver work for the m54xx
but that needs at least:
- moving some files or part of them from /arch/powerpc/sysdev and
/arch/powerpc/include/asm to /drivers/dma and /include/linux,
- renaming the fec_mpc52xx files to a more sensible name,
- providing out_be32 and in_be32 in /arch/m68k/include/asm/io.h,
- and then unifying the interface to BestComm/SmartDma/SDMA and MCD_DMA
in mcf_52xx.c.

An additional problem is that the freescale docs for powerpcs and for
coldfires do not use the same mnemonics for the same registers.

e.g. FEC registers
offset  MPC5200 MCF5484
==  === ===
000 FEC_ID  n/a
004 IEVENT  EIR
008 IMASK   EIMR
010 R_DES_ACTIVEn/a
014 X_DES_ACTIVEn/a
024 ECNTRL  ECR
040 MII_DATAMDATA
044 MII_SPEED   MSCR
064 MIB_CONTROL MIBC
084 R_CNTRL RCR
088 R_HASH  RHR
0C4 X_CNTRL TCR
0E4 PADDR1  PALR
0E8 PADDR2  PAHR
0EC OP_PAUSEOPD
118 IADDR1  IAUR
11C IADDR1  IALR
120 GADDR1  GAUR
124 GADDR2  GALR
144 X_WMRK  FECTFWR
184 RFIFO_DATA  FECRFDR
188

Re: [m68k,powerpc,dma,ethernet,freescale RFA] Coldfire m54xx FEC ethernet driver

2012-10-16 Thread Greg Ungerer

Hi Philippe,

On 09/10/12 19:07, Philippe De Muyter wrote:

[CCing lkml, linux-ppc, netdev, linux-m68k]

Hello kernel sources architects

I have a working driver for the m54xx FEC ethernet driver that I
would like to integrate in the kernel tree.  Problems are that
- this driver needs an associated DMA driver (provided by FreeScale)
wich is not dma-engine enabled
- they're are already many fec drivers in the kernel tree, and
at least one, fec_mpc52xx.c, seems to be very similar (information
below), to the one for the mcf54xx, except it uses a differently
named associated DMA driver (BestComm/SmartDma/SDMA) which is also
not dma-engine enabled, and even kept hidden in /arch/powerpc where
it is inaccessible when compiling for m68k.  The underlying DMA part
from Freescale however seems similar to the one used in the
m54xx. (again, see information below)

So, now I am lost, what should I do ?

The current state of my patches
[http://mailman.uclinux.org/pipermail/uclinux-dev/2012-September/052147.html]
is pushing the freescale provided MCD_DMA dma driver to /drivers/dma,
without adding the dma-engine compatibility layer, and adding the specific
fec_m54xx ethernet driver to /drivers/net/ethernet/freescale


Do you get any responses?
I didn't see any...

Regards
Greg




On Tue, Oct 09, 2012 at 04:12:44PM +1000, Greg Ungerer wrote:

Hi Philippe,

On 05/10/12 01:03, Philippe De Muyter wrote:

On Thu, Oct 04, 2012 at 04:56:01PM +0200, Philippe De Muyter wrote:

On Thu, Oct 04, 2012 at 11:33:32PM +1000, Greg Ungerer wrote:


My biggest concern is the amount of MCD/DMA support code. And it is
all done quite differently to everything else in the kernel. We may
get a bit of push back from kernel folk who look after DMA.


Actually, there is already a similar code in arch/powerpc/sysdev/bestcomm
(also from freescale, maybe an identical part, but I did not find any
usable doc), but the powerpc folks kept that hidden in the arch/powerpc
tree, instead of installing it in drivers/dma.


The MCD DMA or DMA FEC code from freescale has a comment implying that
this
was first used in the MPC8220 part.  And Montavista has a MPC8220 port,
but
I did not find it, so I do not know where they installed the MCD DMA
driver.


Ok, looks like there is a bit a variance in all this.


I also began to read the mpc5200 user's guide parts about the fec and
BestComm/SmartDma/SDMA (not sure which one is the official FreeScale name)
and they look very similar, but not identical, to their m54xx counterparts.

It seems possible to make the fec_mpc52xx.c driver work for the m54xx
but that needs at least:
- moving some files or part of them from /arch/powerpc/sysdev and
   /arch/powerpc/include/asm to /drivers/dma and /include/linux,
- renaming the fec_mpc52xx files to a more sensible name,
- providing out_be32 and in_be32 in /arch/m68k/include/asm/io.h,
- and then unifying the interface to BestComm/SmartDma/SDMA and MCD_DMA
   in mcf_52xx.c.

An additional problem is that the freescale docs for powerpcs and for
coldfires do not use the same mnemonics for the same registers.

e.g. FEC registers
offset  MPC5200 MCF5484
==  === ===
000 FEC_ID  n/a
004 IEVENT  EIR
008 IMASK   EIMR
010 R_DES_ACTIVEn/a
014 X_DES_ACTIVEn/a
024 ECNTRL  ECR
040 MII_DATAMDATA
044 MII_SPEED   MSCR
064 MIB_CONTROL MIBC
084 R_CNTRL RCR
088 R_HASH  RHR
0C4 X_CNTRL TCR
0E4 PADDR1  PALR
0E8 PADDR2  PAHR
0EC OP_PAUSEOPD
118 IADDR1  IAUR
11C IADDR1  IALR
120 GADDR1  GAUR
124 GADDR2  GALR
144 X_WMRK  FECTFWR
184 RFIFO_DATA  FECRFDR
188 RFIFO_STATUSFECRFSR
18C RFIFO_CONTROL   FECRFCR
190 RFIFO_LRF_PTR   FECRLRFP
194 RFIFO_LWF_PTR   FECRLWFP
198 RFIFO_ALARM FECRFAR
19C RFIFO_RDPTR FECRFRP
1A0 RFIFO_WRPTR FECRFWP
1A4 TFIFO_DATA  FECTFDR
1A8 TFIFO_STATUSFECTFSR
1AC TFIFO_CONTROL   FECTFCR
1B0 TFIFO_LRF_PTR   FECTLRFP
1B4 TFIFO_LWF_PTR   FECTLWFP
1B8 TFIFO_ALARM FECTFAR
1BC TFIFO_RDPTR FECTFRP
1C0 TFIFO_WRPTR FECTFWP
1C4 RESET_CNTRL FECFRST
1C8 XMIT_FSMFECCTCWR


Probably the best thing to do is post the patches on the linux kernel
mailing list then, asking for direction on a dma driver.

I have no problem with it going into the arch/m68k area. So that is
always an option.


For the dma engines, the similarity is also obvious.  For example, find
below side by side mpc52xx and m54xx definitions

Re: [2.6 patch] asm/ptrace.h userspace headers cleanup

2008-06-23 Thread Greg Ungerer

Hi Adrian,

Adrian Bunk wrote:
This patch contains the following cleanups for the asm/ptrace.h 
userspace headers:

- include/asm-generic/Kbuild.asm already lists ptrace.h, remove
  the superfluous listings in the Kbuild files of the following
  architectures:
  - cris
  - frv
  - powerpc
  - x86
- don't expose function prototypes and macros to userspace:
  - arm
  - blackfin
  - cris
  - mn10300
  - parisc
- remove #ifdef CONFIG_'s around #define's:
  - blackfin
  - m68knommu
- sh: AFAIK __SH5__ should work in both kernel and userspace,
  no need to leak CONFIG_SUPERH64 to userspace
- xtensa: cosmetical change to remove empty
#ifndef __ASSEMBLY__ #else #endif
  from the userspace headers

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]


The m68knommu looks ok.

Acked-by: Greg Ungerer [EMAIL PROTECTED]



---

Not changed by this patch is the fact that the following architectures 
have a different struct pt_regs depending on CONFIG_ variables:

- h8300
- m68knommu
- mips

This does not work in userspace.


Let me do something about that for m68knommu.

Regards
Greg




 include/asm-arm/ptrace.h   |6 ++
 include/asm-blackfin/ptrace.h  |6 --
 include/asm-cris/arch-v10/Kbuild   |1 -
 include/asm-cris/arch-v10/ptrace.h |4 
 include/asm-cris/arch-v32/Kbuild   |1 -
 include/asm-cris/arch-v32/ptrace.h |4 
 include/asm-cris/ptrace.h  |4 +++-
 include/asm-frv/Kbuild |1 -
 include/asm-m68knommu/ptrace.h |2 --
 include/asm-mn10300/ptrace.h   |8 ++--
 include/asm-parisc/ptrace.h|4 +++-
 include/asm-powerpc/Kbuild |1 -
 include/asm-sh/ptrace.h|2 +-
 include/asm-x86/Kbuild |1 -
 include/asm-xtensa/ptrace.h|   10 +-
 15 files changed, 32 insertions(+), 23 deletions(-)

fc14755b77cff7af5ff00e938a4c493a669e25cd diff --git a/include/asm-arm/ptrace.h 
b/include/asm-arm/ptrace.h
index 7aaa206..8382b75 100644
--- a/include/asm-arm/ptrace.h
+++ b/include/asm-arm/ptrace.h
@@ -139,8 +139,6 @@ static inline int valid_user_regs(struct pt_regs *regs)
return 0;
 }
 
-#endif	/* __KERNEL__ */

-
 #define pc_pointer(v) \
((v)  ~PCMASK)
 
@@ -153,10 +151,10 @@ extern unsigned long profile_pc(struct pt_regs *regs);

 #define profile_pc(regs) instruction_pointer(regs)
 #endif
 
-#ifdef __KERNEL__

 #define predicate(x)   ((x)  0xf000)
 #define PREDICATE_ALWAYS   0xe000
-#endif
+
+#endif /* __KERNEL__ */
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/include/asm-blackfin/ptrace.h b/include/asm-blackfin/ptrace.h

index b8346cd..a45a80e 100644
--- a/include/asm-blackfin/ptrace.h
+++ b/include/asm-blackfin/ptrace.h
@@ -83,14 +83,14 @@ struct pt_regs {
 #define PTRACE_GETREGS12
 #define PTRACE_SETREGS13   /* ptrace signal  */
 
-#ifdef CONFIG_BINFMT_ELF_FDPIC

 #define PTRACE_GETFDPIC   31
 #define PTRACE_GETFDPIC_EXEC  0
 #define PTRACE_GETFDPIC_INTERP1
-#endif
 
 #define PS_S  (0x0002)
 
+#ifdef __KERNEL__

+
 /* user_mode returns true if only one bit is set in IPEND, other than the
master interrupt enable.  */
 #define user_mode(regs) (!(((regs)-ipend  ~0x10)  (((regs)-ipend  ~0x10) 
- 1)))
@@ -98,6 +98,8 @@ struct pt_regs {
 #define profile_pc(regs) instruction_pointer(regs)
 extern void show_regs(struct pt_regs *);
 
+#endif  /*  __KERNEL__  */

+
 #endif /* __ASSEMBLY__ */
 
 /*

diff --git a/include/asm-cris/arch-v10/Kbuild b/include/asm-cris/arch-v10/Kbuild
index 60e7e1b..7a192e1 100644
--- a/include/asm-cris/arch-v10/Kbuild
+++ b/include/asm-cris/arch-v10/Kbuild
@@ -1,4 +1,3 @@
-header-y += ptrace.h
 header-y += user.h
 header-y += svinto.h
 header-y += sv_addr_ag.h
diff --git a/include/asm-cris/arch-v10/ptrace.h 
b/include/asm-cris/arch-v10/ptrace.h
index fb14c5e..2f464ea 100644
--- a/include/asm-cris/arch-v10/ptrace.h
+++ b/include/asm-cris/arch-v10/ptrace.h
@@ -106,10 +106,14 @@ struct switch_stack {
unsigned long return_ip; /* ip that _resume will return to */
 };
 
+#ifdef __KERNEL__

+
 /* bit 8 is user-mode flag */
 #define user_mode(regs) (((regs)-dccr  0x100) != 0)
 #define instruction_pointer(regs) ((regs)-irp)
 #define profile_pc(regs) instruction_pointer(regs)
 extern void show_regs(struct pt_regs *);
 
+#endif  /*  __KERNEL__  */

+
 #endif
diff --git a/include/asm-cris/arch-v32/Kbuild b/include/asm-cris/arch-v32/Kbuild
index a0ec545..35f2fc4 100644
--- a/include/asm-cris/arch-v32/Kbuild
+++ b/include/asm-cris/arch-v32/Kbuild
@@ -1,3 +1,2 @@
-header-y += ptrace.h
 header-y += user.h
 header-y += cryptocop.h
diff --git a/include/asm-cris/arch-v32/ptrace.h 
b/include/asm-cris/arch-v32/ptrace.h
index 516cc70..41f4e86 100644
--- a/include/asm-cris/arch-v32/ptrace.h
+++ b/include/asm-cris/arch-v32/ptrace.h
@@ -106,9 +106,13 @@ struct switch_stack {
unsigned long return_ip; /* ip that _resume will return