deliverable/linux.git
10 years agosparc64: fix sparse warning in tsb.c
Sam Ravnborg [Fri, 16 May 2014 21:26:02 +0000 (23:26 +0200)] 
sparc64: fix sparse warning in tsb.c

Fix following warning:
tsb.c:290:5: warning: symbol 'sysctl_tsb_ratio' was not declared. Should it be static?

Add extern declaration in asm/setup.h and remove local declaration
in kernel/sysctl.c

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: clean up compat_sigset_t.seta handling
Sam Ravnborg [Fri, 16 May 2014 21:26:01 +0000 (23:26 +0200)] 
sparc64: clean up compat_sigset_t.seta handling

Use compat_sigset_t rather than opencode the array
Drop "switch (_NSIG_WORDS)" as we know this is always 1
Introduce BUILD_BUG_ON() to catch if this changes

As a side-effect of this fix following sparse warnings:
signal32.c:220:60: warning: invalid access past the end of 'seta' (12 8)
signal32.c:220:42: warning: invalid access past the end of 'seta' (8 8)
signal32.c:219:60: warning: invalid access past the end of 'seta' (20 8)
signal32.c:219:42: warning: invalid access past the end of 'seta' (16 8)
signal32.c:218:60: warning: invalid access past the end of 'seta' (28 8)
signal32.c:218:42: warning: invalid access past the end of 'seta' (24 8)
signal32.c:309:68: warning: invalid access past the end of 'seta' (12 8)
signal32.c:309:46: warning: invalid access past the end of 'seta' (8 8)
signal32.c:308:68: warning: invalid access past the end of 'seta' (20 8)
signal32.c:308:46: warning: invalid access past the end of 'seta' (16 8)
signal32.c:307:68: warning: invalid access past the end of 'seta' (28 8)
signal32.c:307:46: warning: invalid access past the end of 'seta' (24 8)

They all pointed to code that was never executed - so no bugs fixed.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse "Should it be static?" warnings in signal32.c
Sam Ravnborg [Fri, 16 May 2014 21:26:00 +0000 (23:26 +0200)] 
sparc64: fix sparse "Should it be static?" warnings in signal32.c

Fix following warnings:
signal32.c:140:6: warning: symbol 'do_sigreturn32' was not declared. Should it be static?
signal32.c:230:17: warning: symbol 'do_rt_sigreturn32' was not declared. Should it be static?
signal32.c:729:6: warning: symbol 'do_signal32' was not declared. Should it be static?
signal32.c:773:16: warning: symbol 'do_sys32_sigstack' was not declared. Should it be static?

Add proper prototypes and drop local prototype

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warnings in sys_sparc32.c
Sam Ravnborg [Fri, 16 May 2014 21:25:59 +0000 (23:25 +0200)] 
sparc64: fix sparse warnings in sys_sparc32.c

Fix following warnings:
sys_sparc32.c:52:17: warning: symbol 'sys32_truncate64' was not declared. Should it be static?
sys_sparc32.c:60:17: warning: symbol 'sys32_ftruncate64' was not declared. Should it be static?
sys_sparc32.c:98:17: warning: symbol 'compat_sys_stat64' was not declared. Should it be static?
sys_sparc32.c:109:17: warning: symbol 'compat_sys_lstat64' was not declared. Should it be static?
sys_sparc32.c:120:17: warning: symbol 'compat_sys_fstat64' was not declared. Should it be static?
sys_sparc32.c:131:17: warning: symbol 'compat_sys_fstatat64' was not declared. Should it be static?
sys_sparc32.c:196:27: warning: symbol 'sys32_pread64' was not declared. Should it be static?
sys_sparc32.c:205:27: warning: symbol 'sys32_pwrite64' was not declared. Should it be static?
sys_sparc32.c:214:17: warning: symbol 'compat_sys_readahead' was not declared. Should it be static?
sys_sparc32.c:222:6: warning: symbol 'compat_sys_fadvise64' was not declared. Should it be static?
sys_sparc32.c:230:6: warning: symbol 'compat_sys_fadvise64_64' was not declared. Should it be static?
sys_sparc32.c:241:6: warning: symbol 'sys32_sync_file_range' was not declared. Should it be static?
sys_sparc32.c:249:17: warning: symbol 'compat_sys_fallocate' was not declared. Should it be static?

Add proper prototypes in systbls.h
Include linux/compat.h to get access to necessary types
Use inverse christmas tree order in includes

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warning in pci.c
Sam Ravnborg [Fri, 16 May 2014 21:25:58 +0000 (23:25 +0200)] 
sparc64: fix sparse warning in pci.c

Fix following warning:
pci.c:886:5: warning: symbol 'pci64_dma_supported' was not declared. Should it be static?

Add proper prototype in kernel.h and delete local prototype in iommu.c

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warnings in smp_64.c
Sam Ravnborg [Fri, 16 May 2014 21:25:57 +0000 (23:25 +0200)] 
sparc64: fix sparse warnings in smp_64.c

Fix following warnings:
smp_64.c:88:6: warning: symbol 'smp_callin' was not declared. Should it be static?
smp_64.c:133:6: warning: symbol 'cpu_panic' was not declared. Should it be static?
smp_64.c:187:6: warning: symbol 'smp_synchronize_tick_client' was not declared. Should it be static?
smp_64.c:821:18: warning: symbol 'smp_call_function_client' was not declared. Should it be static?
smp_64.c:827:18: warning: symbol 'smp_call_function_single_client' was not declared. Should it be static?
smp_64.c:964:18: warning: symbol 'smp_new_mmu_context_version_client' was not declared. Should it be static?
smp_64.c:1149:6: warning: symbol 'smp_capture' was not declared. Should it be static?
smp_64.c:1171:6: warning: symbol 'smp_release' was not declared. Should it be static?
smp_64.c:1190:18: warning: symbol 'smp_penguin_jailcell' was not declared. Should it be static?
smp_64.c:1410:18: warning: symbol 'smp_receive_signal_client' was not declared. Should it be static?

Add prototypes in kernel.h or asm/smp_64.h as appropriate.
Delete duplicate function kimage_addr_to_ra(), and
adapt parameter to const void * to match the broader use.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warning in prom_64.c
Sam Ravnborg [Fri, 16 May 2014 21:25:56 +0000 (23:25 +0200)] 
sparc64: fix sparse warning in prom_64.c

Fix following warning:
prom_64.c:376:6: warning: symbol 'arch_find_n_match_cpu_physical_id' was not declared. Should it be static?

Add missing include to pick up prototype.
Rearrange includes to use the inverse christmas tree structure.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warning in btext.c
Sam Ravnborg [Fri, 16 May 2014 21:25:55 +0000 (23:25 +0200)] 
sparc64: fix sparse warning in btext.c

Fix following warning:
btext.c:140:6: warning: symbol 'btext_drawchar' was not declared. Should it be static?

Define the function static as it is only used in this file.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warnings in sys_sparc_64.c + unaligned_64.c
Sam Ravnborg [Fri, 16 May 2014 21:25:54 +0000 (23:25 +0200)] 
sparc64: fix sparse warnings in sys_sparc_64.c + unaligned_64.c

Fix following warnings:
kernel/sys_sparc_64.c:643:17: warning: symbol 'sys_kern_features' was not declared. Should it be static?
kernel/unaligned_64.c:297:17: warning: symbol 'kernel_unaligned_trap' was not declared. Should it be static?
kernel/unaligned_64.c:387:5: warning: symbol 'handle_popc' was not declared. Should it be static?
kernel/unaligned_64.c:428:5: warning: symbol 'handle_ldf_stq' was not declared. Should it be static?
kernel/unaligned_64.c:553:6: warning: symbol 'handle_ld_nf' was not declared. Should it be static?
kernel/unaligned_64.c:579:6: warning: symbol 'handle_lddfmna' was not declared. Should it be static?
kernel/unaligned_64.c:643:6: warning: symbol 'handle_stdfmna' was not declared. Should it be static?

Functions that are only used in kernel/ - add prototypes in kernel.h
Functions used outside kernel/ - add prototype in asm/setup.h
Removed local prototypes

One of the local prototypes had wrong signature (return void - not int).

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warning in process_64.c
Sam Ravnborg [Fri, 16 May 2014 21:25:53 +0000 (23:25 +0200)] 
sparc64: fix sparse warning in process_64.c

Fix following warning:
process_64.c:91:25: warning: non-ANSI function declaration of function 'arch_cpu_idle_dead'

Add proper (void) to function definition

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: fix sparse warning in traps_64.c
Sam Ravnborg [Fri, 16 May 2014 21:25:52 +0000 (23:25 +0200)] 
sparc64: fix sparse warning in traps_64.c

Fix following warning:
traps_64.c:2384:6: error: symbol 'die_if_kernel' redeclared with different type (originally declared at include/asm/bug.h:23) - different modifiers

Add proper __noreturn to the implementation to fix this

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc: drop use of extern for prototypes in arch/sparc/*
Sam Ravnborg [Fri, 16 May 2014 21:25:51 +0000 (23:25 +0200)] 
sparc: drop use of extern for prototypes in arch/sparc/*

Drop the remaining uses of extern for prototypes in .h files
in the sparc specific part of the kernel tree.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc: drop use of extern for prototypes in arch/sparc/include/asm
Sam Ravnborg [Fri, 16 May 2014 21:25:50 +0000 (23:25 +0200)] 
sparc: drop use of extern for prototypes in arch/sparc/include/asm

Drop extern for all prototypes and adjust alignment of parameters
as required after the removal.
In a few rare cases adjust linelength to conform to maximum 80 chars,
and likewise in a few rare cases adjust alignment of parameters
to static functions.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: drop tadpole specific code
Sam Ravnborg [Fri, 16 May 2014 21:25:49 +0000 (23:25 +0200)] 
sparc32: drop tadpole specific code

tadpole.c assigned cpu_pwr_save based on the current configuration.
The rest of the tadpole.c file was only used if cpu_pwr_save was
dereferenced.
But this variable was never dereferenced - and I went back to a 2.6.12
kernel to check (from June 2005) - and not even then was it used.

Drop this code as it has not been in use for ~10 years.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc: fix sparse warning in math_{32,64}
Sam Ravnborg [Fri, 16 May 2014 21:25:48 +0000 (23:25 +0200)] 
sparc: fix sparse warning in math_{32,64}

Fix following sparse warning:
math_{32,64}.c: warning: symbol 'do_mathemu' was not declared. Should it be static?

Add prototype in processor_{32,64} and drop extern in traps_{32,64}.c

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc64: remove cast from output constraints in math asm statements
Sam Ravnborg [Fri, 16 May 2014 21:25:47 +0000 (23:25 +0200)] 
sparc64: remove cast from output constraints in math asm statements

The following asm statements generated a sparse warning:

        asm("addcc \n\t" : "=r" (((USItype)(r2)))

warning: asm output is not an lvalue

When asking on the sparse mailing list Linus replyed:

"
Those casts to (USItype) are all pointless to begin with (since the
values are of that type already!) and they mean that the expression
isn't something you can assign to (lvalue).
"

In the math emulation code drop all casts in the output
parts of the asm statements.

This fixes a lot of "warning: asm output is not an lvalue" sparse
warnings in math_64.c.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: remove cast from output constraints in math asm statements
Sam Ravnborg [Fri, 16 May 2014 21:25:46 +0000 (23:25 +0200)] 
sparc32: remove cast from output constraints in math asm statements

The following asm statements generated a sparse warning:

        asm("addcc \n\t" : "=r" (((USItype)(r2)))

warning: asm output is not an lvalue

When asking on the sparse mailing list Linus replyed:

"
Those casts to (USItype) are all pointless to begin with (since the
values are of that type already!) and they mean that the expression
isn't something you can assign to (lvalue).
"

In the math emulation code drop all casts in the output
parts of the asm statements.

This fixes a lot of "warning: asm output is not an lvalue" sparse
warnings in math_32.c.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in sys_sparc_32.c
Sam Ravnborg [Fri, 16 May 2014 21:25:45 +0000 (23:25 +0200)] 
sparc32: fix sparse warnings in sys_sparc_32.c

Fix following warnings:
sys_sparc_32.c:32:26: warning: symbol 'sys_getpagesize' was not declared. Should it be static?
sys_sparc_32.c:71:16: warning: symbol 'sparc_pipe' was not declared. Should it be static?
sys_sparc_32.c:96:26: warning: symbol 'sys_mmap2' was not declared. Should it be static?
sys_sparc_32.c:106:26: warning: symbol 'sys_mmap' was not declared. Should it be static?
sys_sparc_32.c:114:6: warning: symbol 'sparc_remap_file_pages' was not declared. Should it be static?
sys_sparc_32.c:127:1: warning: symbol 'c_sys_nis_syscall' was not declared. Should it be static?
sys_sparc_32.c:144:1: warning: symbol 'sparc_breakpoint' was not declared. Should it be static?
sys_sparc_32.c:200:16: warning: symbol 'sys_getdomainname' was not declared. Should it be static?

Adapt systbls.h for use by both sparc32 + sparc64.
In the process modify the return type of a few functions.

Change return type from unsigned long to long:
sys_mmap2()
sys_mmap()

Change return type from int to long:
sparc_pipe()
sys_getdomainname()

The changed return type was done to align with sparc64.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in time_32.c
Sam Ravnborg [Fri, 16 May 2014 21:25:44 +0000 (23:25 +0200)] 
sparc32: fix sparse warnings in time_32.c

Fix following warnings:
time_32.c:63:1: warning: symbol 'rtc_lock' was not declared. Should it be static?
time_32.c:357:13: warning: symbol 'time_init' was not declared. Should it be static?
time_32.c:148:16: warning: dereference of noderef expression

Add extern definition of rtc_lock in mc146818rtc.h.
time_init() is called from init/main.c - add prototype to kernel.h.
Use proper u32 __iomem * for master_l10_counter.
Fix all users.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in auxio_32.c
Sam Ravnborg [Fri, 16 May 2014 21:25:43 +0000 (23:25 +0200)] 
sparc32: fix sparse warning in auxio_32.c

Fix following warning:
auxio_32.c:133:33: warning: cast removes address space of expression

To fix this auxio_power_register had to be defined as u8 _iomem.
Use proper sbus operations on the pointer.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in pcic.c
Sam Ravnborg [Fri, 16 May 2014 21:25:42 +0000 (23:25 +0200)] 
sparc32: fix sparse warnings in pcic.c

Fix following warnings:
pcic.c:164:14: warning: symbol 'pcic_regs' was not declared. Should it be static?
pcic.c:165:14: warning: symbol 'pcic_speculative' was not declared. Should it be static?
pcic.c:166:14: warning: symbol 'pcic_trapped' was not declared. Should it be static?
pcic.c:332:66: warning: Using plain integer as NULL pointer
pcic.c:344:66: warning: Using plain integer as NULL pointer
pcic.c:539:38: warning: Using plain integer as NULL pointer
pcic.c:677:1: warning: symbol 'pcic_pin_to_irq' was not declared. Should it be static?
pcic.c:783:6: warning: symbol 'pcic_nmi' was not declared. Should it be static?

Add extern for pcic_regs.
Define a few variables static.
Replace 0 with NULL.
Delete unused funtion pcic_pin_to_irq().
Include kernel.h so we could drop declaration of
t_nmi and add prototype for pcic_nmi.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in io-unit.c
Sam Ravnborg [Fri, 16 May 2014 21:25:41 +0000 (23:25 +0200)] 
sparc32: fix sparse warning in io-unit.c

Fix following warning:
io-unit.c:56:13: warning: incorrect type in assignment (different address spaces)

The page table for the io unit resides in __iomem.
Fix up all users of the io unit page table.
Introduce sbus helers for all read/write operations.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in iommu.c
Sam Ravnborg [Fri, 16 May 2014 21:25:40 +0000 (23:25 +0200)] 
sparc32: fix sparse warning in iommu.c

Fix following warning:
iommu.c:69:21: warning: incorrect type in assignment (different address spaces)

iommu_struct.regs is __iomem - fix up all users.
Introduce sbus operations for all read/write operations.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix build breakage
Sam Ravnborg [Fri, 16 May 2014 21:25:39 +0000 (23:25 +0200)] 
sparc32: fix build breakage

Add forward declaration to kernel.h to fix build breakage
in some configurations

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'sparc32_generic_io_h'
David S. Miller [Fri, 2 May 2014 05:30:28 +0000 (01:30 -0400)] 
Merge branch 'sparc32_generic_io_h'

Sam Ravnborg says:

====================
sparc32: introduce asm-generic

Inspired by Michal Simek <monstr@monstr.eu> this patch-set
introduces asm-generic/io.h for sparc32.

As the diff-stat tells this was a nice code-reduction.

The changes are done on top of the previous sent sparse warning cleanup.
But I do not expect any difficult conflicts if applied alone.

leon_pci + pcic are touched because they had local
and identical implementations of functiones that are
static inline in asm-generic/io.h

leon_pci_grpci1 + leon_pci_grpci2 are touched becuse they
used a sparc spacific implmentation of swab32.
They have just been changed to use the global variant.

I also looked at sparc64 - but there were to many
sparc64 assembler implementations of the io
functons - and the generic io.h did not support this mix.

The last patch kills a few defines in io.h for sbus.
I assume they were introduced before the functions
were all shifted over to __iomem style pointers.
The same could be done for sparc64 - but then
there were even more of the same so I left
this for another time.

The patch-set has been build tested only.
My attempts to test this using qemu have failed as
the qemu version I have errors out.
And my fedora box are mssing some libs to build
qemu from source :-(
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: clean up io_32.h
Sam Ravnborg [Sat, 26 Apr 2014 07:57:37 +0000 (09:57 +0200)] 
sparc32: clean up io_32.h

After introducing asm-generic/io.h a few things could still be cleaned up
o Drop useless macro indirection for sbus_* io access methods
  They were in the past used to hide casts between long and pointers
  but this is no longer so
o Fix function definitions for sbus memory functions so
  return value appear on same line as function name

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: introduce asm-generic/io.h
Sam Ravnborg [Sat, 26 Apr 2014 07:57:36 +0000 (09:57 +0200)] 
sparc32: introduce asm-generic/io.h

Use asm-generic/io.h definitions where applicable.
The inxx() and outxx() methods whcih was duplicated in pcic.c +
leon_pci.c are replaced by a set of static inlins from asm-generic/io.h

iomap.c is replaced by the generic versions, but are still
present to support sparc64.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: replace flip_dword() with swab32()
Sam Ravnborg [Sat, 26 Apr 2014 07:57:35 +0000 (09:57 +0200)] 
sparc32: replace flip_dword() with swab32()

The latter is a generic implmentation.
flip_{,d}word() is sparc32 specific and will be dropped.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc: move page_to_phys to page.h
Sam Ravnborg [Sat, 26 Apr 2014 07:57:34 +0000 (09:57 +0200)] 
sparc: move page_to_phys to page.h

Preparation for introducing asm-generic/io.h this move was required.
In asm-generic page_to_phys is placed in page.h - so do the same here.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'sparc32-sparse'
David S. Miller [Tue, 29 Apr 2014 05:12:34 +0000 (01:12 -0400)] 
Merge branch 'sparc32-sparse'

Sam Ravnborg says:

====================
sparse warning fixes in arch/sparc/

The following patch-set address a lot of sparse warnings
in the sparc32 specific parts of arch/sparc/.
A few sparc64 bits are touched too when code are shared.

Within arch/sparc/mm/ only two warnings remains.
These are related to the return value of of_ioremap() which is __iomem.

Within arch/sparc/kernel/ only three files now produces sparse warnings:
    sys_sparc_32.c
    time_32.c
    auxio_32.c

The fixes was not obvious so the warnings was left for now.

When looking at tadpole.c I was left with the impression that most
of the code was actually unused - but for now I added a "TODO".

This is made on top of 3.15-rc2.

This set replaces the two sets sent the last days.
V2:
- Do not add extern in front of prototypes.
- Tidy up a few changelongs

There are still sparse warnings left that are easy to address.
But this fixes the majority.
====================

10 years agosparc32: fix sparse warnings in leon_smp.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:44 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in leon_smp.c

Fix following warnings:
leon_smp.c:133:6: warning: symbol 'leon_smp_setbroadcast' was not declared. Should it be static?
leon_smp.c:151:14: warning: symbol 'leon_smp_getbroadcast' was not declared. Should it be static?
leon_smp.c:269:6: warning: symbol 'leon_irq_rotate' was not declared. Should it be static?
leon_smp.c:355:6: warning: symbol 'leonsmp_ipi_interrupt' was not declared. Should it be static?
leon_smp.c:457:6: warning: symbol 'leon_cross_call_irq' was not declared. Should it be static?

Add static.
Remove unused functions.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in sun4d_smp.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:43 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in sun4d_smp.c

Fix following warnings:
sun4d_smp.c:113:13: warning: symbol 'smp4d_boot_cpus' was not declared. Should it be static?
sun4d_smp.c:121:5: warning: symbol 'smp4d_boot_one_cpu' was not declared. Should it be static?
sun4d_smp.c:162:13: warning: symbol 'smp4d_smp_done' was not declared. Should it be static?
sun4d_smp.c:353:6: warning: symbol 'smp4d_cross_call_irq' was not declared. Should it be static?
sun4d_smp.c:363:6: warning: symbol 'smp4d_percpu_timer_interrupt' was not declared. Should it be static?

Add proper declarations

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in sun4m_smp.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:42 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in sun4m_smp.c

Fix following warnings:
sun4m_smp.c:72:13: warning: symbol 'smp4m_boot_cpus' was not declared. Should it be static?
sun4m_smp.c:78:5: warning: symbol 'smp4m_boot_one_cpu' was not declared. Should it be static?
sun4m_smp.c:120:13: warning: symbol 'smp4m_smp_done' was not declared. Should it be static?
sun4m_smp.c:230:6: warning: symbol 'smp4m_cross_call_irq' was not declared. Should it be static?
sun4m_smp.c:240:6: warning: symbol 'smp4m_percpu_timer_interrupt' was not declared. Should it be static?

Add proper declarations.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in leon_pmc.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:41 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in leon_pmc.c

Fix following warnings:
leon_pmc.c:15:14: warning: symbol 'pmc_leon_fixup_ids' was not declared. Should it be static?
leon_pmc.c:22:5: warning: symbol 'pmc_leon_need_fixup' was not declared. Should it be static?
leon_pmc.c:41:6: warning: symbol 'pmc_leon_idle_fixup' was not declared. Should it be static?
leon_pmc.c:65:6: warning: symbol 'pmc_leon_idle' was not declared. Should it be static?

Add static to definitions.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in leon_kernel.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:40 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in leon_kernel.c

Fix following warnings:
leon_kernel.c:40:15: warning: symbol 'leon3_gptimer_idx' was not declared. Should it be static?
leon_kernel.c:68:6: warning: symbol 'leon_eirq_setup' was not declared. Should it be static?
leon_kernel.c:273:13: warning: symbol 'leon_percpu_timer_ce_interrupt' was not declared. Should it be static?

Define symbols as static.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc: fix sparse warnings in of_device_common.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:39 +0000 (21:39 +0200)] 
sparc: fix sparse warnings in of_device_common.c

Fix following warnings (both sparc32 and sparc64):
of_device_common.c:13:14: warning: symbol 'irq_of_parse_and_map' was not declared. Should it be static?
of_device_common.c:24:5: warning: symbol 'of_address_to_resource' was not declared. Should it be static?
of_device_common.c:37:14: warning: symbol 'of_iomap' was not declared. Should it be static?

Add missing includes.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in unaligned_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:38 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in unaligned_32.c

Fix following warnings:
unaligned_32.c:146:15: warning: symbol 'safe_compute_effective_address' was not declared. Should it be static?
unaligned_32.c:235:17: warning: symbol 'kernel_unaligned_trap' was not declared. Should it be static?
unaligned_32.c:319:17: warning: symbol 'user_unaligned_trap' was not declared. Should it be static?

Add proper declarations in kernel.h + setup.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in ptrace_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:37 +0000 (21:39 +0200)] 
sparc32: fix sparse warning in ptrace_32.c

Fix following warning:
ptrace_32.c:444:16: warning: symbol 'syscall_trace' was not declared. Should it be static?

Add declaration in kernel.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in smp_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:36 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in smp_32.c

Fix following warnings:
smp_32.c:300:6: warning: symbol 'arch_cpu_pre_starting' was not declared. Should it be static?
smp_32.c:320:6: warning: symbol 'arch_cpu_pre_online' was not declared. Should it be static?
smp_32.c:347:6: warning: symbol 'sparc_start_secondary' was not declared. Should it be static?

Add missing static definition.

This left one warning:
   warning: symbol 'setup_profiling_timer' was not declared.

This is a global symbol that has no declaration in any global header.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in auxio_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:35 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in auxio_32.c

Fix following warnings:
auxio_32.c:23:14: warning: symbol 'auxio_register' was not declared. Should it be static?
auxio_32.c:26:13: warning: symbol 'auxio_probe' was not declared. Should it be static?
auxio_32.c:108:13: warning: symbol 'auxio_power_probe' was not declared. Should it be static?

Add proper decalarations for the above.

The leaves one sparse warning:
auxio_32.c:130:33: warning: cast removes address space of expression

This is here:
    auxio_power_register = (unsigned char *) of_ioremap()

This is __iomem that is removed from return value of of_ioremap()
The pointer is later used without any helpers in process_32.c:
    *auxio_power_register |= AUXIO_POWER_OFF;

It would be simple to introduce a few sbus() helpers.
But as I was not sure this was correct the warning are left as-is.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in leon_pci_grpci2.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:34 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in leon_pci_grpci2.c

Fix following warnings:
leon_pci_grpci2.c:218:1: warning: symbol 'grpci2_dev_lock' was not declared. Should it be static?
leon_pci_grpci2.c:219:20: warning: symbol 'grpci2priv' was not declared. Should it be static?
leon_pci_grpci2.c:221:5: warning: symbol 'grpci2_map_irq' was not declared. Should it be static?
leon_pci_grpci2.c:564:6: warning: symbol 'grpci2_hw_init' was not declared. Should it be
static?

+ a lot of these:
leon_pci_grpci2.c:252:9: warning: incorrect type in argument 1 (different address spaces)

Declare the symbols static as they are only used in this file.
Added missing __iomem annotations.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in leon_pci_grpci1.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:33 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in leon_pci_grpci1.c

Fix following warnings:
leon_pci_grpci1.c:104:5: warning: symbol 'grpci1_map_irq' was not declared. Should it be static?
leon_pci_grpci1.c:420:6: warning: symbol 'grpci1_hw_init' was not declared. Should it be static?
+ a lot of these:
leon_pci_grpci1.c:693:18: warning: incorrect type in argument 1 (different address spaces)

Added missing static to definitions.
Added __iomem annotations

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in tadpole.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:32 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in tadpole.c

Fix following warnings:
tadpole.c:21:6: warning: symbol 'cpu_pwr_save' was not declared. Should it be static?
tadpole.c:101:13: warning: symbol 'clock_stop_probe' was not declared. Should it be static?

This actually revealed that cpu_pwr_save is only assigned.
It was left static with a TODO comment for now - this should be cleaned up later.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in devices.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:31 +0000 (21:39 +0200)] 
sparc32: fix sparse warning in devices.c

Fix following warning:
devices.c:114:13: warning: symbol 'device_scan' was not declared. Should it be static?

Add prototype to asm/setup.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc: fix sparse warnings in cpu.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:30 +0000 (21:39 +0200)] 
sparc: fix sparse warnings in cpu.c

Fix following sparc32 warning:
cpu.c:430:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?

Fix following sparc64 warnings:
cpu.c:364:14: warning: symbol 'dcache_parity_tl1_occurred' was not declared. Should it be static?
cpu.c:365:14: warning: symbol 'icache_parity_tl1_occurred' was not declared. Should it be static?

Rearrange asm/cpu.h to share more stuff between sparc32 and sparc64.
Added missing include to cpu.c of kernel.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in windows.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:29 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in windows.c

Fix following warnings:
windows.c:16:6: warning: symbol 'flush_user_windows' was not declared. Should it be static?
windows.c:109:6: warning: symbol 'try_to_clear_window_buffer' was not declared. Should it be static?

Add missing include of cacheflush.h + add declaration of try_to_clear_window_buffer in kernel.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in setup_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:28 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in setup_32.c

Fix following warnings:
setup_32.c:106:15: warning: symbol 'cmdline_memory_size' was not declared. Should it be static?
setup_32.c:270:16: warning: symbol 'fake_swapper_regs' was not declared. Should it be static?
setup_32.c:368:55: warning: Using plain integer as NULL pointer

Add missing declaration of cmdline_memory_size and remove the local one in init_32.c
fake_swapper_regs was only used locally - so defined static.
When replacing 0 with NULL also add a few spaces around operators

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in ioport.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:27 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in ioport.c

Fix following warnings:
ioport.c:189:38: warning: Using plain integer as NULL pointer
ioport.c:78:25: warning: symbol 'sparc_iomap' was not declared. Should it be static?
ioport.c:403:20: warning: symbol 'sbus_dma_ops' was not declared. Should it be static?
ioport.c:684:39: warning: Using plain integer as NULL pointer

Add one missing prototype, and use NULL.
sbus_dma_ops declared static.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in signal_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:26 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in signal_32.c

Fix following warnings:
signal_32.c:62:17: warning: symbol 'do_sigreturn' was not declared. Should it be static?
signal_32.c:126:17: warning: symbol 'do_rt_sigreturn' was not declared. Should it be static?
signal_32.c:344:39: warning: incorrect type in initializer (different address spaces)
signal_32.c:344:39:    expected struct __siginfo_fpu_t [usertype] *fp
signal_32.c:344:39:    got void [noderef] <asn:1>*[assigned] tail
signal_32.c:346:45: warning: incorrect type in argument 2 (different address spaces)
signal_32.c:346:45:    expected struct __siginfo_fpu_t [noderef] [usertype] <asn:1>*fpu
signal_32.c:346:45:    got struct __siginfo_fpu_t [usertype] *fp
signal_32.c:352:41: warning: incorrect type in initializer (different address spaces)
signal_32.c:352:41:    expected struct __siginfo_rwin_t [usertype] *rwp
signal_32.c:352:41:    got void [noderef] <asn:1>*[assigned] tail
signal_32.c:354:48: warning: incorrect type in argument 2 (different address spaces)
signal_32.c:354:48:    expected struct __siginfo_rwin_t [noderef] [usertype] <asn:1>*rwin
signal_32.c:354:48:    got struct __siginfo_rwin_t [usertype] *rwp
signal_32.c:509:6: warning: symbol 'do_notify_resume' was not declared. Should it be static?
signal_32.c:520:16: warning: symbol 'do_sys_sigstack' was not declared. Should it be static?

Add missing prototypes and annotate two variables with __user.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in process_32.h
Sam Ravnborg [Mon, 21 Apr 2014 19:39:25 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in process_32.h

Fix following warnings:
process_32.c:67:6: warning: symbol 'arch_cpu_idle' was not declared. Should it be static?
process_32.c:257:16: warning: symbol 'sparc_do_fork' was not declared. Should it be static?
process_32.c:411:5: warning: symbol 'dump_fpu' was not declared. Should it be static?

Add missing includes and add one missing prototype.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in irq_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:24 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in irq_32.c

Fix following warnings:
irq_32.c:239:5: warning: symbol 'sparc_floppy_request_irq' was not declared. Should it be static?
irq_32.c:294:24: warning: symbol 'fdc_status' was not declared. Should it be static?
irq_32.c:297:6: warning: symbol 'pdma_vaddr' was not declared. Should it be static?
irq_32.c:300:15: warning: symbol 'pdma_size' was not declared. Should it be static?
irq_32.c:303:14: warning: symbol 'doing_pdma' was not declared. Should it be static?
irq_32.c:306:6: warning: symbol 'pdma_base' was not declared. Should it be static?
irq_32.c:309:15: warning: symbol 'pdma_areasize' was not declared. Should it be static?
irq_32.c:317:6: warning: symbol 'sparc_floppy_irq' was not declared. Should it be static?

The floppy parts were all added to iasm/setup.h - no other header files looked obvious.
floppy_32.h was not an option as this file can only be included once from the
floppy driver.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in sun4d_irq.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:23 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in sun4d_irq.c

Fix following warnings:
sun4d_irq.c:146:6: warning: symbol 'sun4d_handler_irq' was not declared. Should it be static?
sun4d_irq.c:239:17: warning: symbol 'sun4d_irq' was not declared. Should it be static?
sun4d_irq.c:288:14: warning: symbol '_sun4d_build_device_irq' was not declared. Should it be static?
sun4d_irq.c:323:14: warning: symbol 'sun4d_build_device_irq' was not declared. Should it be static?
sun4d_irq.c:386:14: warning: symbol 'sun4d_build_timer_irq' was not declared. Should it be static?
sun4d_irq.c:482:13: warning: symbol 'sun4d_init_sbi_irq' was not declared. Should it be static?

Apply static when applicable, otherwise add prototype

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in sun4m_irq.c and sun4d_irq.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:22 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in sun4m_irq.c and sun4d_irq.c

Fix following warnings:

sun4m_irq.c:308:6: warning: symbol 'sun4m_nmi' was not declared. Should it be static?
sun4m_irq.c:396:28: warning: incorrect type in assignment (different address spaces)
sun4m_irq.c:396:28:    expected unsigned int volatile *extern [addressable] [toplevel] master_l10_counter
sun4d_irq.c:469:28: warning: incorrect type in assignment (different address spaces)
sun4d_irq.c:469:28:    expected unsigned int volatile *extern [addressable] [toplevel] master_l10_counter

master_l10_counter is a pointer to __iomem - add annotations.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in traps_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:21 +0000 (21:39 +0200)] 
sparc32: fix sparse warning in traps_32.c

Fix following warning:
traps_32.c:47:6: error: symbol 'die_if_kernel' redeclared with different type - different modifiers

Add __noreturn to both definition and declaration

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse "Should it be static?" in mm/
Sam Ravnborg [Mon, 21 Apr 2014 19:39:20 +0000 (21:39 +0200)] 
sparc32: fix sparse "Should it be static?" in mm/

Fix following warnings:
srmmu.c:870:13: warning: symbol 'srmmu_paging_init' was not declared. Should it be static?
iommu.c:430:13: warning: symbol 'ld_mmu_iommu' was not declared. Should it be static?
leon_mm.c:21:5: warning: symbol 'srmmu_swprobe_trace' was not declared. Should it be static?

Add proper prototypes or define static to fix them.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warnings in srmmu.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:19 +0000 (21:39 +0200)] 
sparc32: fix sparse warnings in srmmu.c

Fix following warnings:
srmmu.c:78:5: warning: symbol 'flush_page_for_dma_global' was not declared. Should it be static?
srmmu.c:85:5: warning: symbol 'viking_mxcc_present' was not declared. Should it be static?
srmmu.c:103:6: warning: symbol 'srmmu_nocache_bitmap' was not declared. Should it be static?
srmmu.c:176:24: warning: Using plain integer as NULL pointer
srmmu.c:731:46: warning: Using plain integer as NULL pointer
srmmu.c:731:46: warning: Using plain integer as NULL pointer
srmmu.c:731:46: warning: Using plain integer as NULL pointer
srmmu.c:870:13: warning: symbol 'srmmu_paging_init' was not declared. Should it be static?

Add proper prototypes in mm_32.h and drop local prototype in init_32.c
Replace 0 with NULL

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in init_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:18 +0000 (21:39 +0200)] 
sparc32: fix sparse warning in init_32.c

Fix following warning:
init_32.c:112:22: warning: symbol 'bootmem_init' was not declared. Should it be static?

Fix by adding a proper prototype in pgtable_32.h and drop
the local prototype in srmmu.c

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: fix sparse warning in fault_32.c
Sam Ravnborg [Mon, 21 Apr 2014 19:39:17 +0000 (21:39 +0200)] 
sparc32: fix sparse warning in fault_32.c

Fix following warning:
fault_32.c:38:24: error: symbol 'unhandled_fault' redeclared with different type - different modifiers

When this warning was fixed several new warnings popped up - fix them too.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosparc32: rename mm/srmmu.h to mm/mm_32.h
Sam Ravnborg [Mon, 21 Apr 2014 19:39:16 +0000 (21:39 +0200)] 
sparc32: rename mm/srmmu.h to mm/mm_32.h

This file will be used for more than just srmmu stuff, so the old name was misleading.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge tag 'trace-fixes-v3.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 28 Apr 2014 23:57:51 +0000 (16:57 -0700)] 
Merge tag 'trace-fixes-v3.15-rc2' of git://git./linux/kernel/git/rostedt/linux-trace

Pull ftrace bugfix from Steven Rostedt:
 "Takao Indoh reported that he was able to cause a ftrace bug while
  loading a module and enabling function tracing at the same time.

  He uncovered a race where the module when loaded will convert the
  calls to mcount into nops, and expects the module's text to be RW.
  But when function tracing is enabled, it will convert all kernel text
  (core and module) from RO to RW to convert the nops to calls to ftrace
  to record the function.  After the convertion, it will convert all the
  text back from RW to RO.

  The issue is, it will also convert the module's text that is loading.
  If it converts it to RO before ftrace does its conversion, it will
  cause ftrace to fail and require a reboot to fix it again.

  This patch moves the ftrace module update that converts calls to
  mcount into nops to be done when the module state is still
  MODULE_STATE_UNFORMED.  This will ignore the module when the text is
  being converted from RW back to RO"

* tag 'trace-fixes-v3.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  ftrace/module: Hardcode ftrace_module_init() call into load_module()

10 years agoMerge tag 'dt-for-linus' of git://git.secretlab.ca/git/linux
Linus Torvalds [Mon, 28 Apr 2014 22:19:06 +0000 (15:19 -0700)] 
Merge tag 'dt-for-linus' of git://git.secretlab.ca/git/linux

Pull devicetree bug fixes from Grant Likely:
 "These are some important bug fixes that need to get into v3.15.

  This branch contains a pair of important bug fixes for the DT code:

   - Fix some incorrect binding property names before they enter common
     usage

   - Fix bug where some platform devices will be unable to get their
     interrupt number when they depend on an interrupt controller that
     is not available at device creation time.  This is a problem
     causing mainline to fail on a number of ARM platforms"

* tag 'dt-for-linus' of git://git.secretlab.ca/git/linux:
  of/irq: do irq resolution in platform_get_irq
  of: selftest: add deferred probe interrupt test
  dt: Fix binding typos in clock-names and interrupt-names

10 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Mon, 28 Apr 2014 21:58:15 +0000 (14:58 -0700)] 
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc

Pull powerpc fixes from Ben Herrenschmidt:
 "Here is a bunch of post-merge window fixes that have been accumulating
  in patchwork while I was on vacation or buried under other stuff last
  week.

  We have the now usual batch of LE fixes from Anton (sadly some new
  stuff that went into this merge window had endian issues, we'll try to
  make sure we do better next time)

  Some fixes and cleanups to the new 24x7 performance monitoring stuff
  (mostly typos and cleaning up printk's)

  A series of fixes for an issue with our runlatch bit, which wasn't set
  properly for offlined threads/cores and under KVM, causing potentially
  some counters to misbehave along with possible power management
  issues.

  A fix for kexec nasty race where the new kernel wouldn't "see" the
  secondary processors having reached back into firmware in time.

  And finally a few other misc (and pretty simple) bug fixes"

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (33 commits)
  powerpc/4xx: Fix section mismatch in ppc4xx_pci.c
  ppc/kvm: Clear the runlatch bit of a vcpu before napping
  ppc/kvm: Set the runlatch bit of a CPU just before starting guest
  ppc/powernv: Set the runlatch bits correctly for offline cpus
  powerpc/pseries: Protect remove_memory() with device hotplug lock
  powerpc: Fix error return in rtas_flash module init
  powerpc: Bump BOOT_COMMAND_LINE_SIZE to 2048
  powerpc: Bump COMMAND_LINE_SIZE to 2048
  powerpc: Rename duplicate COMMAND_LINE_SIZE define
  powerpc/perf/hv-24x7: Catalog version number is be64, not be32
  powerpc/perf/hv-24x7: Remove [static 4096], sparse chokes on it
  powerpc/perf/hv-24x7: Use (unsigned long) not (u32) values when calling plpar_hcall_norets()
  powerpc/perf/hv-gpci: Make device attr static
  powerpc/perf/hv_gpci: Probe failures use pr_debug(), and padding reduced
  powerpc/perf/hv_24x7: Probe errors changed to pr_debug(), padding fixed
  powerpc/mm: Fix tlbie to add AVAL fields for 64K pages
  powerpc/powernv: Fix little endian issues in OPAL dump code
  powerpc/powernv: Create OPAL sglist helper functions and fix endian issues
  powerpc/powernv: Fix little endian issues in OPAL error log code
  powerpc/powernv: Fix little endian issues with opal_do_notifier calls
  ...

10 years agomm: don't pointlessly use BUG_ON() for sanity check
Linus Torvalds [Mon, 28 Apr 2014 21:24:09 +0000 (14:24 -0700)] 
mm: don't pointlessly use BUG_ON() for sanity check

BUG_ON() is a big hammer, and should be used _only_ if there is some
major corruption that you cannot possibly recover from, making it
imperative that the current process (and possibly the whole machine) be
terminated with extreme prejudice.

The trivial sanity check in the vmacache code is *not* such a fatal
error.  Recovering from it is absolutely trivial, and using BUG_ON()
just makes it harder to debug for no actual advantage.

To make matters worse, the placement of the BUG_ON() (only if the range
check matched) actually makes it harder to hit the sanity check to begin
with, so _if_ there is a bug (and we just got a report from Srivatsa
Bhat that this can indeed trigger), it is harder to debug not just
because the machine is possibly dead, but because we don't have better
coverage.

BUG_ON() must *die*.  Maybe we should add a checkpatch warning for it,
because it is simply just about the worst thing you can ever do if you
hit some "this cannot happen" situation.

Reported-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoftrace/module: Hardcode ftrace_module_init() call into load_module()
Steven Rostedt (Red Hat) [Thu, 24 Apr 2014 14:40:12 +0000 (10:40 -0400)] 
ftrace/module: Hardcode ftrace_module_init() call into load_module()

A race exists between module loading and enabling of function tracer.

CPU 1 CPU 2
----- -----
  load_module()
   module->state = MODULE_STATE_COMING

register_ftrace_function()
 mutex_lock(&ftrace_lock);
 ftrace_startup()
  update_ftrace_function();
   ftrace_arch_code_modify_prepare()
    set_all_module_text_rw();
   <enables-ftrace>
    ftrace_arch_code_modify_post_process()
     set_all_module_text_ro();

[ here all module text is set to RO,
  including the module that is
  loading!! ]

   blocking_notifier_call_chain(MODULE_STATE_COMING);
    ftrace_init_module()

     [ tries to modify code, but it's RO, and fails!
       ftrace_bug() is called]

When this race happens, ftrace_bug() will produces a nasty warning and
all of the function tracing features will be disabled until reboot.

The simple solution is to treate module load the same way the core
kernel is treated at boot. To hardcode the ftrace function modification
of converting calls to mcount into nops. This is done in init/main.c
there's no reason it could not be done in load_module(). This gives
a better control of the changes and doesn't tie the state of the
module to its notifiers as much. Ftrace is special, it needs to be
treated as such.

The reason this would work, is that the ftrace_module_init() would be
called while the module is in MODULE_STATE_UNFORMED, which is ignored
by the set_all_module_text_ro() call.

Link: http://lkml.kernel.org/r/1395637826-3312-1-git-send-email-indou.takao@jp.fujitsu.com
Reported-by: Takao Indoh <indou.takao@jp.fujitsu.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@vger.kernel.org # 2.6.38+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
10 years agopowerpc/4xx: Fix section mismatch in ppc4xx_pci.c
Alistair Popple [Tue, 8 Apr 2014 04:20:19 +0000 (14:20 +1000)] 
powerpc/4xx: Fix section mismatch in ppc4xx_pci.c

This patch fixes this section mismatch:

WARNING: vmlinux.o(.text+0x1efc4): Section mismatch in reference from
the function apm821xx_pciex_init_port_hw() to the function
.init.text:ppc4xx_pciex_wait_on_sdr.isra.9()

The function apm821xx_pciex_init_port_hw() references the function
__init ppc4xx_pciex_wait_on_sdr.isra.9().  This is often because
apm821xx_pciex_init_port_hw lacks a __init annotation or the
annotation of ppc4xx_pciex_wait_on_sdr.isra.9 is wrong.

apm821xx_pciex_init_port_hw is only referenced by a struct in
__initdata, so it should be safe to add __init to
apm821xx_pciex_init_port_hw.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agoppc/kvm: Clear the runlatch bit of a vcpu before napping
Preeti U Murthy [Fri, 11 Apr 2014 10:32:08 +0000 (16:02 +0530)] 
ppc/kvm: Clear the runlatch bit of a vcpu before napping

When the guest cedes the vcpu or the vcpu has no guest to
run it naps. Clear the runlatch bit of the vcpu before
napping to indicate an idle cpu.

Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agoppc/kvm: Set the runlatch bit of a CPU just before starting guest
Preeti U Murthy [Fri, 11 Apr 2014 10:31:58 +0000 (16:01 +0530)] 
ppc/kvm: Set the runlatch bit of a CPU just before starting guest

The secondary threads in the core are kept offline before launching guests
in kvm on powerpc: "371fefd6f2dc4666:KVM: PPC: Allow book3s_hv guests to use
SMT processor modes."

Hence their runlatch bits are cleared. When the secondary threads are called
in to start a guest, their runlatch bits need to be set to indicate that they
are busy. The primary thread has its runlatch bit set though, but there is no
harm in setting this bit once again. Hence set the runlatch bit for all
threads before they start guest.

Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agoppc/powernv: Set the runlatch bits correctly for offline cpus
Preeti U Murthy [Fri, 11 Apr 2014 10:31:48 +0000 (16:01 +0530)] 
ppc/powernv: Set the runlatch bits correctly for offline cpus

Up until now we have been setting the runlatch bits for a busy CPU and
clearing it when a CPU enters idle state. The runlatch bit has thus
been consistent with the utilization of a CPU as long as the CPU is online.

However when a CPU is hotplugged out the runlatch bit is not cleared. It
needs to be cleared to indicate an unused CPU. Hence this patch has the
runlatch bit cleared for an offline CPU just before entering an idle state
and sets it immediately after it exits the idle state.

Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/pseries: Protect remove_memory() with device hotplug lock
Li Zhong [Thu, 10 Apr 2014 08:25:31 +0000 (16:25 +0800)] 
powerpc/pseries: Protect remove_memory() with device hotplug lock

While testing memory hot-remove, I found following dead lock:

Process #1141 is drmgr, trying to remove some memory, i.e. memory499.
It holds the memory_hotplug_mutex, and blocks when trying to remove file
"online" under dir memory499, in kernfs_drain(), at
        wait_event(root->deactivate_waitq,
                   atomic_read(&kn->active) == KN_DEACTIVATED_BIAS);

Process #1120 is trying to online memory499 by
   echo 1 > memory499/online

In .kernfs_fop_write, it uses kernfs_get_active() to increase
&kn->active, thus blocking process #1141. While itself is blocked later
when trying to acquire memory_hotplug_mutex, which is held by process

The backtrace of both processes are shown below:

[<c000000001b18600>] 0xc000000001b18600
[<c000000000015044>] .__switch_to+0x144/0x200
[<c000000000263ca4>] .online_pages+0x74/0x7b0
[<c00000000055b40c>] .memory_subsys_online+0x9c/0x150
[<c00000000053cbe8>] .device_online+0xb8/0x120
[<c00000000053cd04>] .online_store+0xb4/0xc0
[<c000000000538ce4>] .dev_attr_store+0x64/0xa0
[<c00000000030f4ec>] .sysfs_kf_write+0x7c/0xb0
[<c00000000030e574>] .kernfs_fop_write+0x154/0x1e0
[<c000000000268450>] .vfs_write+0xe0/0x260
[<c000000000269144>] .SyS_write+0x64/0x110
[<c000000000009ffc>] syscall_exit+0x0/0x7c

[<c000000001b18600>] 0xc000000001b18600
[<c000000000015044>] .__switch_to+0x144/0x200
[<c00000000030be14>] .__kernfs_remove+0x204/0x300
[<c00000000030d428>] .kernfs_remove_by_name_ns+0x68/0xf0
[<c00000000030fb38>] .sysfs_remove_file_ns+0x38/0x60
[<c000000000539354>] .device_remove_attrs+0x54/0xc0
[<c000000000539fd8>] .device_del+0x158/0x250
[<c00000000053a104>] .device_unregister+0x34/0xa0
[<c00000000055bc14>] .unregister_memory_section+0x164/0x170
[<c00000000024ee18>] .__remove_pages+0x108/0x4c0
[<c00000000004b590>] .arch_remove_memory+0x60/0xc0
[<c00000000026446c>] .remove_memory+0x8c/0xe0
[<c00000000007f9f4>] .pseries_remove_memblock+0xd4/0x160
[<c00000000007fcfc>] .pseries_memory_notifier+0x27c/0x290
[<c0000000008ae6cc>] .notifier_call_chain+0x8c/0x100
[<c0000000000d858c>] .__blocking_notifier_call_chain+0x6c/0xe0
[<c00000000071ddec>] .of_property_notify+0x7c/0xc0
[<c00000000071ed3c>] .of_update_property+0x3c/0x1b0
[<c0000000000756cc>] .ofdt_write+0x3dc/0x740
[<c0000000002f60fc>] .proc_reg_write+0xac/0x110
[<c000000000268450>] .vfs_write+0xe0/0x260
[<c000000000269144>] .SyS_write+0x64/0x110
[<c000000000009ffc>] syscall_exit+0x0/0x7c

This patch uses lock_device_hotplug() to protect remove_memory() called
in pseries_remove_memblock(), which is also stated before function
remove_memory():

 * NOTE: The caller must call lock_device_hotplug() to serialize hotplug
 * and online/offline operations before this call, as required by
 * try_offline_node().
 */
void __ref remove_memory(int nid, u64 start, u64 size)

With this lock held, the other process(#1120 above) trying to online the
memory block will retry the system call when calling
lock_device_hotplug_sysfs(), and finally find No such device error.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Fix error return in rtas_flash module init
Anton Blanchard [Mon, 14 Apr 2014 11:23:32 +0000 (21:23 +1000)] 
powerpc: Fix error return in rtas_flash module init

module_init should return 0 or a negative errno.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Bump BOOT_COMMAND_LINE_SIZE to 2048
Anton Blanchard [Mon, 14 Apr 2014 11:55:25 +0000 (21:55 +1000)] 
powerpc: Bump BOOT_COMMAND_LINE_SIZE to 2048

Bump the boot wrapper BOOT_COMMAND_LINE_SIZE to match the
kernel.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Bump COMMAND_LINE_SIZE to 2048
Anton Blanchard [Mon, 14 Apr 2014 11:54:52 +0000 (21:54 +1000)] 
powerpc: Bump COMMAND_LINE_SIZE to 2048

I've had a report that the current limit is too small for
an automated network based installer. Bump it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Rename duplicate COMMAND_LINE_SIZE define
Anton Blanchard [Mon, 14 Apr 2014 11:54:05 +0000 (21:54 +1000)] 
powerpc: Rename duplicate COMMAND_LINE_SIZE define

We have two definitions of COMMAND_LINE_SIZE, one for the kernel
and one for the boot wrapper. I assume this is so the boot
wrapper can be self sufficient and not rely on kernel headers.

Having two defines with the same name is confusing, I just
updated the wrong one when trying to bump it.

Make the boot wrapper define unique by calling it
BOOT_COMMAND_LINE_SIZE.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/perf/hv-24x7: Catalog version number is be64, not be32
Cody P Schafer [Tue, 15 Apr 2014 17:10:55 +0000 (10:10 -0700)] 
powerpc/perf/hv-24x7: Catalog version number is be64, not be32

The catalog version number was changed from a be32 (with proceeding
32bits of padding) to a be64, update the code to treat it as a be64

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/perf/hv-24x7: Remove [static 4096], sparse chokes on it
Cody P Schafer [Tue, 15 Apr 2014 17:10:54 +0000 (10:10 -0700)] 
powerpc/perf/hv-24x7: Remove [static 4096], sparse chokes on it

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/perf/hv-24x7: Use (unsigned long) not (u32) values when calling plpar_hcall_n...
Cody P Schafer [Tue, 15 Apr 2014 17:10:53 +0000 (10:10 -0700)] 
powerpc/perf/hv-24x7: Use (unsigned long) not (u32) values when calling plpar_hcall_norets()

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/perf/hv-gpci: Make device attr static
Cody P Schafer [Tue, 15 Apr 2014 17:10:52 +0000 (10:10 -0700)] 
powerpc/perf/hv-gpci: Make device attr static

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/perf/hv_gpci: Probe failures use pr_debug(), and padding reduced
Cody P Schafer [Tue, 15 Apr 2014 17:10:51 +0000 (10:10 -0700)] 
powerpc/perf/hv_gpci: Probe failures use pr_debug(), and padding reduced

fixup for "powerpc/perf: Add support for the hv gpci (get performance
counter info) interface".

Makes the "not enabled" message less awful (and hidden unless
debugging).

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/perf/hv_24x7: Probe errors changed to pr_debug(), padding fixed
Cody P Schafer [Tue, 15 Apr 2014 17:10:50 +0000 (10:10 -0700)] 
powerpc/perf/hv_24x7: Probe errors changed to pr_debug(), padding fixed

fixup for "powerpc/perf: Add support for the hv 24x7 interface"

Makes the "not enabled" message less awful (and hides it in most cases).

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/mm: Fix tlbie to add AVAL fields for 64K pages
Aneesh Kumar K.V [Mon, 21 Apr 2014 05:07:36 +0000 (10:37 +0530)] 
powerpc/mm: Fix tlbie to add AVAL fields for 64K pages

The if condition check was based on a draft ISA doc. Remove the same.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix little endian issues in OPAL dump code
Anton Blanchard [Tue, 22 Apr 2014 05:01:27 +0000 (15:01 +1000)] 
powerpc/powernv: Fix little endian issues in OPAL dump code

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Create OPAL sglist helper functions and fix endian issues
Anton Blanchard [Tue, 22 Apr 2014 05:01:26 +0000 (15:01 +1000)] 
powerpc/powernv: Create OPAL sglist helper functions and fix endian issues

We have two copies of code that creates an OPAL sg list. Consolidate
these into a common set of helpers and fix the endian issues.

The flash interface embedded a version number in the num_entries
field, whereas the dump interface did did not. Since versioning
wasn't added to the flash interface and it is impossible to add
this in a backwards compatible way, just remove it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix little endian issues in OPAL error log code
Anton Blanchard [Tue, 22 Apr 2014 05:01:25 +0000 (15:01 +1000)] 
powerpc/powernv: Fix little endian issues in OPAL error log code

Fix little endian issues with the OPAL error log code.

Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix little endian issues with opal_do_notifier calls
Anton Blanchard [Tue, 22 Apr 2014 05:01:24 +0000 (15:01 +1000)] 
powerpc/powernv: Fix little endian issues with opal_do_notifier calls

The bitmap in opal_poll_events and opal_handle_interrupt is
big endian, so we need to byteswap it on little endian builds.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Remove some OPAL function declaration duplication
Anton Blanchard [Tue, 22 Apr 2014 05:01:23 +0000 (15:01 +1000)] 
powerpc/powernv: Remove some OPAL function declaration duplication

We had some duplication of the internal OPAL functions.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Use uint64_t instead of size_t in OPAL APIs
Anton Blanchard [Tue, 22 Apr 2014 05:01:22 +0000 (15:01 +1000)] 
powerpc/powernv: Use uint64_t instead of size_t in OPAL APIs

Using size_t in our APIs is asking for trouble, especially
when some OPAL calls use size_t pointers.

Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Release the refcount for pci_dev
Wei Yang [Wed, 23 Apr 2014 02:26:33 +0000 (10:26 +0800)] 
powerpc/powernv: Release the refcount for pci_dev

On PowerNV platform, we are holding an unnecessary refcount on a pci_dev, which
leads to the pci_dev is not destroyed when hotplugging a pci device.

This patch release the unnecessary refcount.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Reduce multi-hit of iommu_add_device()
Wei Yang [Wed, 23 Apr 2014 02:26:32 +0000 (10:26 +0800)] 
powerpc/powernv: Reduce multi-hit of iommu_add_device()

During the EEH hotplug event, iommu_add_device() will be invoked three times
and two of them will trigger warning or error.

The three times to invoke the iommu_add_device() are:

    pci_device_add
       ...
       set_iommu_table_base_and_group   <- 1st time, fail
    device_add
       ...
       tce_iommu_bus_notifier           <- 2nd time, succees
    pcibios_add_pci_devices
       ...
       pcibios_setup_bus_devices        <- 3rd time, re-attach

The first time fails, since the dev->kobj->sd is not initialized. The
dev->kobj->sd is initialized in device_add().
The third time's warning is triggered by the re-attach of the iommu_group.

After applying this patch, the error

    iommu_tce: 0003:05:00.0 has not been added, ret=-14

and the warning

    [  204.123609] ------------[ cut here ]------------
    [  204.123645] WARNING: at arch/powerpc/kernel/iommu.c:1125
    [  204.123680] Modules linked in: xt_CHECKSUM nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT bnep bluetooth 6lowpan_iphc rfkill xt_conntrack ebtable_nat ebtable_broute bridge stp llc mlx4_ib ib_sa ib_mad ib_core ib_addr ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw bnx2x tg3 mlx4_core nfsd ptp mdio ses libcrc32c nfs_acl enclosure be2net pps_core shpchp lockd kvm uinput sunrpc binfmt_misc lpfc scsi_transport_fc ipr scsi_tgt
    [  204.124356] CPU: 18 PID: 650 Comm: eehd Not tainted 3.14.0-rc5yw+ #102
    [  204.124400] task: c0000027ed485670 ti: c0000027ed50c000 task.ti: c0000027ed50c000
    [  204.124453] NIP: c00000000003cf80 LR: c00000000006c648 CTR: c00000000006c5c0
    [  204.124506] REGS: c0000027ed50f440 TRAP: 0700   Not tainted  (3.14.0-rc5yw+)
    [  204.124558] MSR: 9000000000029032 <SF,HV,EE,ME,IR,DR,RI>  CR: 88008084  XER: 20000000
    [  204.124682] CFAR: c00000000006c644 SOFTE: 1
    GPR00: c00000000006c648 c0000027ed50f6c0 c000000001398380 c0000027ec260300
    GPR04: c0000027ea92c000 c00000000006ad00 c0000000016e41b0 0000000000000110
    GPR08: c0000000012cd4c0 0000000000000001 c0000027ec2602ff 0000000000000062
    GPR12: 0000000028008084 c00000000fdca200 c0000000000d1d90 c0000027ec281a80
    GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000001
    GPR24: 000000005342697b 0000000000002906 c000001fe6ac9800 c000001fe6ac9800
    GPR28: 0000000000000000 c0000000016e3a80 c0000027ea92c090 c0000027ea92c000
    [  204.125353] NIP [c00000000003cf80] .iommu_add_device+0x30/0x1f0
    [  204.125399] LR [c00000000006c648] .pnv_pci_ioda_dma_dev_setup+0x88/0xb0
    [  204.125443] Call Trace:
    [  204.125464] [c0000027ed50f6c0] [c0000027ed50f750] 0xc0000027ed50f750 (unreliable)
    [  204.125526] [c0000027ed50f750] [c00000000006c648] .pnv_pci_ioda_dma_dev_setup+0x88/0xb0
    [  204.125588] [c0000027ed50f7d0] [c000000000069cc8] .pnv_pci_dma_dev_setup+0x78/0x340
    [  204.125650] [c0000027ed50f870] [c000000000044408] .pcibios_setup_device+0x88/0x2f0
    [  204.125712] [c0000027ed50f940] [c000000000046040] .pcibios_setup_bus_devices+0x60/0xd0
    [  204.125774] [c0000027ed50f9c0] [c000000000043acc] .pcibios_add_pci_devices+0xdc/0x1c0
    [  204.125837] [c0000027ed50fa50] [c00000000086f970] .eeh_reset_device+0x36c/0x4f0
    [  204.125939] [c0000027ed50fb20] [c00000000003a2d8] .eeh_handle_normal_event+0x448/0x480
    [  204.126068] [c0000027ed50fbc0] [c00000000003a35c] .eeh_handle_event+0x4c/0x340
    [  204.126192] [c0000027ed50fc80] [c00000000003a74c] .eeh_event_handler+0xfc/0x1b0
    [  204.126319] [c0000027ed50fd30] [c0000000000d1ea0] .kthread+0x110/0x130
    [  204.126430] [c0000027ed50fe30] [c00000000000a460] .ret_from_kernel_thread+0x5c/0x7c
    [  204.126556] Instruction dump:
    [  204.126610] 7c0802a6 fba1ffe8 fbc1fff0 fbe1fff8 f8010010 f821ff71 7c7e1b78 60000000
    [  204.126787] 60000000 e87e0298 3143ffff 7d2a1910 <0b0900002fa90000 40de00c8 ebfe0218
    [  204.126966] ---[ end trace 6e7aefd80add2973 ]---

are cleared.

This patch removes iommu_add_device() in pnv_pci_ioda_dma_dev_setup(), which
revert part of the change in commit d905c5df(PPC: POWERNV: move
iommu_add_device earlier).

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix little endian issues in OPAL flash code
Anton Blanchard [Wed, 23 Apr 2014 21:25:34 +0000 (07:25 +1000)] 
powerpc/powernv: Fix little endian issues in OPAL flash code

With this patch I was able to update firmware on an LE kernel.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix kexec races going back to OPAL
Benjamin Herrenschmidt [Thu, 24 Apr 2014 06:14:25 +0000 (16:14 +1000)] 
powerpc/powernv: Fix kexec races going back to OPAL

We have a subtle race when sending CPUs back to OPAL on kexec.

We mark them as "in real mode" right before we send them down. Once
we've booted the new kernel, it might try to call opal_reinit_cpus()
to change endianness, and that requires all CPUs to be spinning inside
OPAL.

However there is no synchronization here and we've observed cases
where the returning CPUs hadn't established their new state inside
OPAL before opal_reinit_cpus() is called, causing it to fail.

The proper fix is to actually wait for them to go down all the way
from the kexec'ing kernel.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Check sysparam size before creation
Joel Stanley [Thu, 24 Apr 2014 07:25:37 +0000 (16:55 +0930)] 
powerpc/powernv: Check sysparam size before creation

The size of the sysparam sysfs files is determined from the device tree
at boot. However the buffer is hard coded to 64 bytes. If we encounter a
parameter that is larger than 64, or miss-parse the device tree, the
buffer will overflow when reading or writing to the parameter.

Check it at discovery time, and if the parameter is too large, do not
create a sysfs entry for it.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix typos in sysparam code
Joel Stanley [Thu, 24 Apr 2014 07:25:36 +0000 (16:55 +0930)] 
powerpc/powernv: Fix typos in sysparam code

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Check sysfs size before copying
Joel Stanley [Thu, 24 Apr 2014 07:25:35 +0000 (16:55 +0930)] 
powerpc/powernv: Check sysfs size before copying

The sysparam code currently uses the userspace supplied number of
bytes when memcpy()ing in to a local 64-byte buffer.

Limit the maximum number of bytes by the size of the buffer.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Use ssize_t for sysparam return values
Joel Stanley [Thu, 24 Apr 2014 07:25:34 +0000 (16:55 +0930)] 
powerpc/powernv: Use ssize_t for sysparam return values

The OPAL calls are returning int64_t values, which the sysparam code
stores in an int, and the sysfs callback returns ssize_t. Make code a
easier to read by consistently using ssize_t.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc/powernv: Fix sysparam sysfs error handling
Joel Stanley [Thu, 24 Apr 2014 07:25:33 +0000 (16:55 +0930)] 
powerpc/powernv: Fix sysparam sysfs error handling

When a sysparam query in OPAL returned a negative value (error code),
sysfs would spew out a decent chunk of memory; almost 64K more than
expected. This was traced to a sign/unsigned mix up in the OPAL sysparam
sysfs code at sys_param_show.

The return value of sys_param_show is a ssize_t, calculated using

  return ret ? ret : attr->param_size;

Alan Modra explains:

  "attr->param_size" is an unsigned int, "ret" an int, so the overall
  expression has type unsigned int.  Result is that ret is cast to
  unsigned int before being cast to ssize_t.

Instead of using the ternary operator, set ret to the param_size if an
error is not detected. The same bug exists in the sysfs write callback;
this patch fixes it in the same way.

A note on debugging this next time: on my system gcc will warn about
this if compiled with -Wsign-compare, which is not enabled by -Wall,
only -Wextra.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Fix Oops in rtas_stop_self()
Li Zhong [Mon, 28 Apr 2014 00:29:51 +0000 (08:29 +0800)] 
powerpc: Fix Oops in rtas_stop_self()

commit 41dd03a9 may cause Oops in rtas_stop_self().

The reason is that the rtas_args was moved into stack space. For a box
with more that 4GB RAM, the stack could easily be outside 32bit range,
but RTAS is 32bit.

So the patch moves rtas_args away from stack by adding static before
it.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Export flush_icache_range
Jeff Mahoney [Sun, 27 Apr 2014 22:10:43 +0000 (18:10 -0400)] 
powerpc: Export flush_icache_range

Commit aac416fc38c (lkdtm: flush icache and report actions) calls
flush_icache_range from a module. It's exported on most architectures
that implement it, but not on powerpc. This patch exports it to fix
the module link failure.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agoLinux 3.15-rc3
Linus Torvalds [Mon, 28 Apr 2014 02:29:27 +0000 (19:29 -0700)] 
Linux 3.15-rc3

10 years agoword-at-a-time: avoid undefined behaviour in zero_bytemask macro
Will Deacon [Wed, 23 Apr 2014 16:52:52 +0000 (17:52 +0100)] 
word-at-a-time: avoid undefined behaviour in zero_bytemask macro

The asm-generic, big-endian version of zero_bytemask creates a mask of
bytes preceding the first zero-byte by left shifting ~0ul based on the
position of the first zero byte.

Unfortunately, if the first (top) byte is zero, the output of
prep_zero_mask has only the top bit set, resulting in undefined C
behaviour as we shift left by an amount equal to the width of the type.
As it happens, GCC doesn't manage to spot this through the call to fls(),
but the issue remains if architectures choose to implement their shift
instructions differently.

An example would be arch/arm/ (AArch32), where LSL Rd, Rn, #32 results
in Rd == 0x0, whilst on arch/arm64 (AArch64) LSL Xd, Xn, #64 results in
Xd == Xn.

Rather than check explicitly for the problematic shift, this patch adds
an extra shift by 1, replacing fls with __fls. Since zero_bytemask is
never called with a zero argument (has_zero() is used to check the data
first), we don't need to worry about calling __fls(0), which is
undefined.

Cc: <stable@vger.kernel.org>
Cc: Victor Kamensky <victor.kamensky@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoMerge branch 'safe-dirty-tlb-flush'
Linus Torvalds [Sun, 27 Apr 2014 22:08:12 +0000 (15:08 -0700)] 
Merge branch 'safe-dirty-tlb-flush'

This merges the patch to fix possible loss of dirty bit on munmap() or
madvice(DONTNEED).  If there are concurrent writers on other CPU's that
have the unmapped/unneeded page in their TLBs, their writes to the page
could possibly get lost if a third CPU raced with the TLB flush and did
a page_mkclean() before the page was fully written.

Admittedly, if you unmap() or madvice(DONTNEED) an area _while_ another
thread is still busy writing to it, you deserve all the lost writes you
could get.  But we kernel people hold ourselves to higher quality
standards than "crazy people deserve to lose", because, well, we've seen
people do all kinds of crazy things.

So let's get it right, just because we can, and we don't have to worry
about it.

* safe-dirty-tlb-flush:
  mm: split 'tlb_flush_mmu()' into tlb flushing and memory freeing parts

This page took 0.082869 seconds and 5 git commands to generate.