Commit graph

73 commits

Author SHA1 Message Date
Rob Herring f7a6e01c8c nios2: remove arch specific early_init_dt_alloc_memory_arch
Now that the DT core code handles bootmem arches, we can remove the nios2
specific early_init_dt_alloc_memory_arch function.

Cc: Ley Foon Tan <lftan@altera.com>
Cc: nios2-dev@lists.rocketboards.org
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Rob Herring <robh@kernel.org>
2018-01-30 11:17:12 -06:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Guenter Roeck 65d1e3ddea nios2: time: Read timer in get_cycles only if initialized
Mainline crashes as follows when running nios2 images.

On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat c8408fa0, node_mem_map c8726000
  Normal zone: 512 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 65536 pages, LIFO batch:15
Unable to handle kernel NULL pointer dereference at virtual address 00000000
ea = c8003cb0, ra = c81cbf40, cause = 15
Kernel panic - not syncing: Oops

Problem is seen because get_cycles() is called before the timer it depends
on is initialized. Returning 0 in that situation fixes the problem.

Fixes: 33d72f3822 ("init/main.c: extract early boot entropy from the ..")
Cc: Laura Abbott <labbott@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-09-15 20:30:58 +08:00
Daniel Lezcano ba5d08c0ea clocksource/drivers: Rename clocksource_probe to timer_probe
The function name is now renamed to 'timer_probe' for consistency with
the CLOCKSOURCE_OF_DECLARE => TIMER_OF_DECLARE change.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2017-06-14 11:59:16 +02:00
Daniel Lezcano 1727339590 clocksource/drivers: Rename CLOCKSOURCE_OF_DECLARE to TIMER_OF_DECLARE
The CLOCKSOURCE_OF_DECLARE macro is used widely for the timers to declare the
clocksource at early stage. However, this macro is also used to initialize
the clockevent if any, or the clockevent only.

It was originally suggested to declare another macro to initialize a
clockevent, so in order to separate the two entities even they belong to the
same IP. This was not accepted because of the impact on the DT where splitting
a clocksource/clockevent definition does not make sense as it is a Linux
concept not a hardware description.

On the other side, the clocksource has not interrupt declared while the
clockevent has, so it is easy from the driver to know if the description is
for a clockevent or a clocksource, IOW it could be implemented at the driver
level.

So instead of dealing with a named clocksource macro, let's use a more generic
one: TIMER_OF_DECLARE.

The patch has not functional changes.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2017-06-14 11:58:45 +02:00
Tobias Klauser e118c3fec9 nios2: remove custom early console implementation
As of commits d8f347ba35cf ("nios2: enable earlycon support"),
0dcc0542a0 ("serial: altera_jtaguart: add earlycon support") and
4d9d7d896d ("serial: altera_uart: add earlycon support"), the nios2
architecture and the altera_uart/altera_jtaguart drivers support
earlycon. Thus, the custom early console implementation for nios2 is no
longer necessary to get early boot messages. Remove it and rely fully on
earlycon support.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-05-11 17:44:21 +08:00
Marek Vasut edebea9877 nios2: Add CDX support
Add support for the CDX Code Density Extensions present in
Nios II R2 . This introduces new 16bit instruction set to
improve code density while retaining support for the 32bit
Nios II R2 instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>
2017-05-08 16:59:19 +08:00
Marek Vasut 23460839b9 nios2: Add BMX support
Add support for the BMX Bit Manipulation Extensions present in
Nios II R2 . This introduces three new instructions, EXTRACT,
INSERT and MERGE.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>
2017-05-08 16:59:19 +08:00
Marek Vasut a89988a6e0 nios2: Add NIOS2_ARCH_REVISION to select between R1 and R2
Allow user to select between Nios2 R1 and R2. Since R1 and R2 are
not binary compatible, we cannot have a single kernel binary and
there is no point in having DT property for discerning these two.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>
2017-05-08 16:59:19 +08:00
Tobias Klauser 44a4ed4257 nios2: enable earlycon support
Enable generic earlycon support for nios2. This e.g. allows to use a
8250/16650 UART as earlycon.

In order to get the earlycon, we just need to call parse_early_param()
in early_init_devtree() as soon as the device tree is initially scanned.
By adding an stdout-path property to the dts (done in this patch for
10m50_devboard), the earlycon can be used.

In order to provide early printk support, we need to provide a dummy
implementation of early_console_write(), so that
arch/nios2/kernel/early_printk.c can still be compiled if neither
SERIAL_ALTERA_JTAGUART_CONSOLE nor SERIAL_ALTERA_UART_CONSOLE is
selected. As soon as the altera_uart and altera_jtaguart support
earlycon, the entire file can be removed.

Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
2017-05-08 16:59:19 +08:00
Tobias Klauser 57ac76ed6c nios2: constify irq_domain_ops
struct irq_domain_ops is not modified, so it can be made const.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
2017-05-08 16:59:19 +08:00
Tobias Klauser 6852aa0263 nios2: add .gitignore entries for auto-generated files
Add .gitignore entries for nios2 specific files generated during the
build process.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
2017-05-08 16:59:19 +08:00
Tobias Klauser 921d701e6f nios2: reserve boot memory for device tree
Make sure to reserve the boot memory for the flattened device tree.
Otherwise it might get overwritten, e.g. when initial_boot_params is
copied, leading to a corrupted FDT and a boot hang/crash:

  bootconsole [early0] enabled
  Early console on uart16650 initialized at 0xf8001600
  OF: fdt: Error -11 processing FDT
  Kernel panic - not syncing: setup_cpuinfo: No CPU found in devicetree!

  ---[ end Kernel panic - not syncing: setup_cpuinfo: No CPU found in devicetree!

Guenter Roeck says:

> I think I found the problem. In unflatten_and_copy_device_tree(), with added
> debug information:
>
> OF: fdt: initial_boot_params=c861e400, dt=c861f000 size=28874 (0x70ca)
>
> ... and then initial_boot_params is copied to dt, which results in corrupted
> fdt since the memory overlaps. Looks like the initial_boot_params memory
> is not reserved and (re-)allocated by early_init_dt_alloc_memory_arch().

Cc: stable@vger.kernel.org
Reported-by: Guenter Roeck <linux@roeck-us.net>
Reference: http://lkml.kernel.org/r/20170226210338.GA19476@roeck-us.net
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
2017-04-02 20:13:57 -07:00
Ingo Molnar 9164bb4a18 sched/headers: Prepare to move 'init_task' and 'init_thread_union' from <linux/sched.h> to <linux/sched/task.h>
Update all usage sites first.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:38 +01:00
Ingo Molnar 589ee62844 sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h>
Update code that relied on sched.h including various MM types for them.

This will allow us to remove the <linux/mm_types.h> include from <linux/sched.h>.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:37 +01:00
Ingo Molnar 68db0cf106 sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h>
We are going to split <linux/sched/task_stack.h> out of <linux/sched.h>, which
will have to be picked up from other headers and a couple of .c files.

Create a trivial placeholder <linux/sched/task_stack.h> file that just
maps to <linux/sched.h> to make this patch obviously correct and
bisectable.

Include the new header in the files that are going to need it.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:36 +01:00
Ingo Molnar 299300258d sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task.h>
We are going to split <linux/sched/task.h> out of <linux/sched.h>, which
will have to be picked up from other headers and a couple of .c files.

Create a trivial placeholder <linux/sched/task.h> file that just
maps to <linux/sched.h> to make this patch obviously correct and
bisectable.

Include the new header in the files that are going to need it.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:35 +01:00
Ingo Molnar b17b01533b sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h>
We are going to split <linux/sched/debug.h> out of <linux/sched.h>, which
will have to be picked up from other headers and a couple of .c files.

Create a trivial placeholder <linux/sched/debug.h> file that just
maps to <linux/sched.h> to make this patch obviously correct and
bisectable.

Include the new header in the files that are going to need it.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:34 +01:00
Thomas Gleixner a5a1d1c291 clocksource: Use a plain u64 instead of cycle_t
There is no point in having an extra type for extra confusion. u64 is
unambiguous.

Conversion was done with the following coccinelle script:

@rem@
@@
-typedef u64 cycle_t;

@fix@
typedef cycle_t;
@@
-cycle_t
+u64

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: John Stultz <john.stultz@linaro.org>
2016-12-25 11:04:12 +01:00
Linus Torvalds 7c0f6ba682 Replace <asm/uaccess.h> with <linux/uaccess.h> globally
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
  sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-24 11:46:01 -08:00
Ley Foon Tan 744606c76c nios2: add screen_info
Fix build error when enable VGA console.

drivers/video/console/vgacon.c:586: undefined reference to `screen_info'

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
2016-12-13 17:13:17 +08:00
Arnd Bergmann 069013a9e2 nios2: fix timer initcall return value
When called more than twice, the nios2_time_init() function return an
uninitialized value, as detected by gcc -Wmaybe-uninitialized

  arch/nios2/kernel/time.c: warning: 'ret' may be used uninitialized in this function

This makes it return '0' here, matching the comment above the function.

Acked-by: Ley Foon Tan <lftan@altera.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-11-11 08:45:08 -08:00
Linus Torvalds ae50a840e7 nios2 update for v4.9-rc1
nios2: use of_property_read_bool
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJX+vyvAAoJEFWoEK+e3syCL4wP/2cPQcRtu/pJy6B6Ll/pwryT
 r2la6NdFCFUl6KH7rTxyjxkz48dc1qf/SB1IKGPhg+qWRTRygivNVFghcwA5do6n
 I5fubkjlg/ZXZNsmxfQRu2zOM/bmV2a/qq7dREQenQlBK5isILB0t+VUzgmwX3vh
 fdq1fgKDONo+KKFxPJNS+HKbiYAAgtEHNhG/2J+lVoGWSAmwQ9XIfdD+k4oQrrQc
 hHRaTHY/JISZwtjlMF5jAoHCdodjoXVuuIylXt/ClwIEfYJuZRWCx0e0ObDuHdf5
 JqtovnmdwQTkJThQhAFjhcVjB2XoHKgpRvEm5GHWY8S0ecS7eBV5nbud+e4fAFmB
 KP/THrweb2QYGCcl8Efz7k7ZLkRreT0VATBuDB/zNVedFxLtwpxig7c3DaYSs9bu
 6jXCmG6l1eJ11gxJvrBbIW222XPkeGftj3/J+YEAD3XcCQG/mNnUumwHT42vbaMO
 pmhVzlsO3S41OXEzpyxj2e6uHMpKPN+kEvfnjPlnmqA2qJneGupqpsrtzgr8VMts
 XtED/HAsVAvT5JaO+3Hu181BPW3pGECdo3V/fPszdDq/A3+iqhMUItfWTEhfOb9Z
 CZckod1Ba1LioqzdCCZBY7vp9IQO9DQgzLlotdDJqePFBLGlKF9mpgrvZF21rw99
 NDyWiWOOer+eZJDlknHS
 =wYAp
 -----END PGP SIGNATURE-----

Merge tag 'nios2-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2

Pull nios2 update from Ley Foon Tan:
 "Use of_property_read_bool() instead of open-coding it"

* tag 'nios2-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
  nios2: use of_property_read_bool
2016-10-10 11:31:19 -07:00
Chris Metcalf 6727ad9e20 nmi_backtrace: generate one-line reports for idle cpus
When doing an nmi backtrace of many cores, most of which are idle, the
output is a little overwhelming and very uninformative.  Suppress
messages for cpus that are idling when they are interrupted and just
emit one line, "NMI backtrace for N skipped: idling at pc 0xNNN".

We do this by grouping all the cpuidle code together into a new
.cpuidle.text section, and then checking the address of the interrupted
PC to see if it lies within that section.

This commit suitably tags x86 and tile idle routines, and only adds in
the minimal framework for other architectures.

Link: http://lkml.kernel.org/r/1472487169-14923-5-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Tested-by: Petr Mladek <pmladek@suse.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-07 18:46:30 -07:00
Ley Foon Tan 476080a793 nios2: use of_property_read_bool
Use of_property_read_bool instead of open-coding it as fpcu_has.
Convert the members of struct cpuinfo from u32 to bool accordingly as
they are only used as boolean anyhow.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Acked-by: Ley Foon Tan <lftan@altera.com>
2016-10-06 18:19:16 +08:00
Daniel Lezcano 177cf6e52b clocksources: Switch back to the clksrc table
All the clocksource drivers's init function are now converted to return
an error code. CLOCKSOURCE_OF_DECLARE is no longer used as well as the
clksrc-of table.

Let's convert back the names:
 - CLOCKSOURCE_OF_DECLARE_RET => CLOCKSOURCE_OF_DECLARE
 - clksrc-of-ret              => clksrc-of

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

For exynos_mct and samsung_pwm_timer:
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

For arch/arc:
Acked-by: Vineet Gupta <vgupta@synopsys.com>

For mediatek driver:
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

For the Rockchip-part
Acked-by: Heiko Stuebner <heiko@sntech.de>

For STi :
Acked-by: Patrice Chotard <patrice.chotard@st.com>

For the mps2-timer.c and versatile.c changes:
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>

For the OXNAS part :
Acked-by: Neil Armstrong <narmstrong@baylibre.com>

For LPC32xx driver:
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>

For Broadcom Kona timer change:
Acked-by: Ray Jui <ray.jui@broadcom.com>

For Sun4i and Sun5i:
Acked-by: Chen-Yu Tsai <wens@csie.org>

For Meson6:
Acked-by: Carlo Caione <carlo@caione.org>

For Keystone:
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>

For NPS:
Acked-by: Noam Camus <noamca@mellanox.com>

For bcm2835:
Acked-by: Eric Anholt <eric@anholt.net>
2016-06-28 10:19:35 +02:00
Daniel Lezcano dd1364a743 clocksource/drivers/nios2: Convert init function to return error
The init functions do not return any error. They behave as the following:

  - panic, thus leading to a kernel crash while another timer may work and
       make the system boot up correctly

  or

  - print an error and let the caller unaware if the state of the system

Change that by converting the init functions to return an error conforming
to the CLOCKSOURCE_OF_RET prototype.

Proper error handling (rollback, errno value) will be changed later case
by case, thus this change just return back an error or success in the init
function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2016-06-28 10:19:34 +02:00
Guenter Roeck 8fe889274c nios2: Replace fdt_translate_address with of_flat_dt_translate_address
nios2 builds fail with the following build error.

arch/nios2/kernel/prom.c: In function 'early_init_dt_scan_serial':
arch/nios2/kernel/prom.c💯2: error:
	implicit declaration of function 'fdt_translate_address'

Commit c90fe9c039 ("of: earlycon: Move address translation to
of_setup_earlycon()") replaced fdt_translate_address() with
of_flat_dt_translate_address() but missed updating the nios2 code.

Fixes: c90fe9c039 ("of: earlycon: Move address translation to of_setup_earlycon()")
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Ley Foon Tan <lftan@altera.com>
2016-03-31 08:15:45 +08:00
Alexander Potapenko be7635e728 arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections
KASAN needs to know whether the allocation happens in an IRQ handler.
This lets us strip everything below the IRQ entry point to reduce the
number of unique stack traces needed to be stored.

Move the definition of __irq_entry to <linux/interrupt.h> so that the
users don't need to pull in <linux/ftrace.h>.  Also introduce the
__softirq_entry macro which is similar to __irq_entry, but puts the
corresponding functions to the .softirqentry.text section.

Signed-off-by: Alexander Potapenko <glider@google.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrey Konovalov <adech.fo@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Konstantin Serebryany <kcc@google.com>
Cc: Dmitry Chernenkov <dmitryc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-25 16:37:42 -07:00
Linus Torvalds f4d68930a8 nios2 update for v4.4-rc1
- nios2: Remove unnecessary #ifdef guards
 - nios2: Switch to generic __xchg()
 - nios2: Fix unused variable warning
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWQDMOAAoJEFWoEK+e3syCIV0QAKrFlUxEeaQbitwc33S1FNS2
 iqVlWsZ8Br5Jf5Hjix2BJFzgOHUpUxYze/P2I1mbQfd/4oxkmY6U4ztJZFyfee3M
 S7qvtqa9RfxsxAb+QfcpYDmA2DYvRa5ewRXsrfRol6GWzCC00iVqDkxhb9ME8k9R
 DsIbO54MTDIy7MdhM5gHm7g5KeVJWqd/jQjvjLSv/AW7E5GtW6UMaCyuzfxCywnm
 mRzafIXuq+0J0X4w9Cznd8oH+qyKOZMJvoTLQYG8HIVwurHJmxbk3Vh/Opilpob7
 Bv6G+X+uDlz81HZ8vloKKlCK/f5r6Zyg1C4XQX5BF3uH/l+IAb5QxC2mzp2b8gCZ
 60cT2Xoy3deuyh9onRMCiHqX6BAdx+LXpFusEC8ksmKfZFZ1/3fMKZWNW+uQLTfC
 FYCoulQbXlCQQdJ/z8FOlDzbZCYWONtRieNFjYk61tiyjiNTVdGIqIEIMUhPdf2Y
 qQwhnjVvoAJaKgs6SkIjDVcEbTzBA6d4Ejj9QRbo/qT2wnnWASsEC7ZzHl+4cU3l
 siWKIYyJM2uxb5rDVAGoG37cXKX9II9jrVwuIRdPvtF7QjiZKEZOBJY+mlGMUhtZ
 rmMIaz44O8FAo17JfDzj5J1sHZ9hLsEoi7mWjloxBjVnFHLh9sr75iYtQznD7u1v
 uGNRdTOCDJ6X01t0IIu/
 =+cHI
 -----END PGP SIGNATURE-----

Merge tag 'nios2-v4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2

Pull nios2 updates from Ley Foon Tan:

 - nios2: Remove unnecessary #ifdef guards
 - nios2: Switch to generic __xchg()
 - nios2: Fix unused variable warning

* tag 'nios2-v4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
  nios2: Remove unnecessary #ifdef guards
  nios2: Switch to generic __xchg()
  nios2: Fix unused variable warning
2015-11-09 16:36:10 -08:00
Marek Vasut 4db2196d0c nios2: Fix unused variable warning
Fix the following compiler splat by adding __maybe_unused annotation to
the variable. Using this particular annotation has the least ugly impact
on the code compared to using ifdeffery.

arch/nios2/kernel/setup.c: In function 'nios2_boot_init':
arch/nios2/kernel/setup.c:107:7: warning: unused variable 'cmdline_passed' [-Wunused-variable]
  char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
       ^

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Ley Foon Tan <lftan@altera.com>
2015-11-09 10:33:29 +08:00
Marc Zyngier 3722ed2380 clocksource: cosmetic: Drop OF 'dependency' from symbols
Seeing the 'of' characters in a symbol that is being called from
ACPI seems to freak out people. So let's do a bit of pointless
renaming so that these folks do feel at home.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-01 02:18:39 +02:00
Bernd Weiberg 3fb39c482c nios2: remove unused statistic counters
Removed some statistic counters to improve the performance of the handler.

Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-09-08 01:32:34 +08:00
Bernd Weiberg db5a7e5546 nios2: fixed variable imm16 to s16
Fxid variable imm16 to s16 instead of u16, offset might be negative.

Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-09-08 01:32:27 +08:00
Viresh Kumar 549a14c14b nios2/time: Migrate to new 'set-state' interface
Migrate nios2 driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now.

This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED.

Cc: Ley Foon Tan <lftan@altera.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Dmitry Torokhov <dtor@chromium.org>
Cc: nios2-dev@lists.rocketboards.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Ley Foon Tan <lftan@altera.com>
2015-09-08 01:30:30 +08:00
Linus Torvalds 31351f73ea nios2 update for v4.2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.5 (GNU/Linux)
 
 iQIVAwUAVZZAgFWoEK+e3syCAQIuPg//TvNf26hftsvVmUOuJk4t1KiqLdagFmR1
 3R5igFF5UgDZ+uf2PU3N7ILzkpFgVA+Hdm3CqgvEcM0YBrsovY9ljPSwWUMKGhZZ
 ZX/EVKtr1uygOP+WAhUvT32wbw9NJYvl5WsahtZuRQW6y7DNiVJCAcsaXXx4Ulq9
 0ePyhCVqkbYLp8cD51pxWwKxdQJunTz38PMvK0bzXW1CYV2/3QfRbKidSIosOb8V
 YxX9dSUOQW0r6AdT6kQ6VQ56ZyTzizVC+aybDirvKPli8UsCpOkBSq2re8g7X9X8
 Okz/Tw4cwdbo4x0WO0b5CeLLBZ3UOn2zpc2WTDK2u/OBueEcYLnK/jdfWlI5wqgj
 L4iHV/rHiITdtU+WkYDl5lmtHOq4/5VyGspy0EVSkUMzQlm+iMfHmK8K49Otn4Zj
 Rpc7UY5sfE834HjJYzrUeCq1+QtL5q5M5op54mQryhjdVcBhBF4SxGyJXu9XSZ56
 QI06OGnyV6fWk0OWxwqjEJfYiSckZ5HtzTWzR0v0TR/uY46Hc5Q14jzp3eWX7hu+
 VndhgT3xrxb/XdPpuDYwmRHycH4J1TEDusXcfL45ak/Z+vyvhYGeod6uqnHfY7Xg
 tOva+SpZCljcKxbsP3eIZNbzyc8ar3MO0VvFW8GW4cZ7njHuN0lREw+Pi9Gbc35a
 dGn1VSBvaIA=
 =+OJA
 -----END PGP SIGNATURE-----

Merge tag 'nios2-v4.2' of git://git.rocketboards.org/linux-socfpga-next

Pull nios2 update from Ley Foon Tan:
 "Check number of timer instances"

* tag 'nios2-v4.2' of git://git.rocketboards.org/linux-socfpga-next:
  nios2: check number of timer instances
2015-07-03 12:22:49 -07:00
Ley Foon Tan a8955cc3a5 nios2: check number of timer instances
Display error message if number of timers is less than 2.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-06-24 17:52:44 +08:00
Herbert Xu c0b59fafe3 Merge branch 'mvebu/drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Merge the mvebu/drivers branch of the arm-soc tree which contains
just a single patch bfa1ce5f38 ("bus:
mvebu-mbus: add mv_mbus_dram_info_nooverlap()") that happens to be
a prerequisite of the new marvell/cesa crypto driver.
2015-06-19 22:07:07 +08:00
Herbert Xu 05dee9c7eb nios2: Export get_cycles
nios2 is the only architecture that does not inline get_cycles
and does not export it.  This breaks crypto as it uses get_cycles
in a number of modules.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2015-06-09 22:26:00 +08:00
Linus Torvalds 05f0c553e2 nios2 update for v4.1-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.5 (GNU/Linux)
 
 iQIVAwUAVTnob1WoEK+e3syCAQLGGg//SmjZ3bV+GK4w7xqoM1CFOAiI+WKnVAEs
 mzmtuJmpzRI7jxo4gSLRAIw49beMA1hNRuQV4GBe1RFgxp3hghl5kKiwyeNVaWDq
 cjsR4NHLwcMjwfAUnz+idiLV9Y4qKUCDU3h4Qt7SdyuHl9DY12GGkGoxIxNT1vdb
 UjguJj174HUmiehSOxGXddzPAbVT807H4BYIjqKJAfc7IusvhKZQZmEsnjMN6oqf
 honeRW6d2klyVs4uNMZy+FziChOGt7D1f5LKhF74PM6D9eesmayjT4HKuCSlzGG8
 I5gYGAoXGRSgo056pel4v1hW+8V+NulzG32cW4A9hiMKJ/rYD5J6Z+tNYgQO2U8k
 xtnDFsjOgvuBt+Ng7bkXIW06DfJ744v6+l0mtPwXYOw2q8zd+mXHO83/l3a0EX+O
 CZUCQPZATRfvGSNb7bar+HCOIwibGiEunpRd9CVe/NImaWhfFvLuKqIwJL/l9eoK
 NJHJo+KuIqlwssY0+HSUtBL2pWmSIrYQac3JI/j4uH4ORGGMAqUSdlk5Ewl3ZxWs
 daW7U2ROWNzWWUL4nKRTG4e+X/hxNOAmiubkvDjRsOLEhRbuRVeqQai/G7pMKbY/
 kHWrNH323NtDvx34zO5tBe+f0EjpJATIw5r1r9ty3NW+xie+vbSGCv+KMzhO7tn4
 5QoF20wfnUE=
 =pK6u
 -----END PGP SIGNATURE-----

Merge tag 'nios2-v4.1-rc1' of git://git.rocketboards.org/linux-socfpga-next

Pull arch/nios2 updates from Ley Foon Tan:

 - update cache management code

 - rework trap handler with new define trap #.

 - fix on check header warning.

* tag 'nios2-v4.1-rc1' of git://git.rocketboards.org/linux-socfpga-next:
  nios2: rework cache
  nios2: Add types.h header required for __u32 type
  nios2: rework trap handler
  nios2: remove end address checking for initda
2015-04-24 07:59:07 -07:00
Ley Foon Tan baa54ab93c nios2: rework trap handler
Redefine trap handler as below:

 0  N/A        reserved for system calls
 1  SIGUSR1    user-defined signal 1
 2  SIGUSR2    user-defined signal 2
 3  SIGILL     illegal instruction
 4..29         reserved (but implemented to raise SIGILL instead of being undefined)
30  SIGTRAP    KGDB
31  SIGTRAP    trace/breakpoint trap

Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-20 11:11:14 +08:00
Joe Perches 4122669e52 nios2: cpuinfo: remove use of seq_printf return value
The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03 ("seq_file: Rename seq_overflow() to
     seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Ley Foon Tan <lftan@altera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-15 16:35:24 -07:00
Linus Torvalds ca2ec32658 Merge branch 'for-linus-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs update from Al Viro:
 "Part one:

   - struct filename-related cleanups

   - saner iov_iter_init() replacements (and switching the syscalls to
     use of those)

   - ntfs switch to ->write_iter() (Anton)

   - aio cleanups and splitting iocb into common and async parts
     (Christoph)

   - assorted fixes (me, bfields, Andrew Elble)

  There's a lot more, including the completion of switchover to
  ->{read,write}_iter(), d_inode/d_backing_inode annotations, f_flags
  race fixes, etc, but that goes after #for-davem merge.  David has
  pulled it, and once it's in I'll send the next vfs pull request"

* 'for-linus-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (35 commits)
  sg_start_req(): use import_iovec()
  sg_start_req(): make sure that there's not too many elements in iovec
  blk_rq_map_user(): use import_single_range()
  sg_io(): use import_iovec()
  process_vm_access: switch to {compat_,}import_iovec()
  switch keyctl_instantiate_key_common() to iov_iter
  switch {compat_,}do_readv_writev() to {compat_,}import_iovec()
  aio_setup_vectored_rw(): switch to {compat_,}import_iovec()
  vmsplice_to_user(): switch to import_iovec()
  kill aio_setup_single_vector()
  aio: simplify arguments of aio_setup_..._rw()
  aio: lift iov_iter_init() into aio_setup_..._rw()
  lift iov_iter into {compat_,}do_readv_writev()
  NFS: fix BUG() crash in notify_change() with patch to chown_common()
  dcache: return -ESTALE not -EBUSY on distributed fs race
  NTFS: Version 2.1.32 - Update file write from aio_write to write_iter.
  VFS: Add iov_iter_fault_in_multipages_readable()
  drop bogus check in file_open_root()
  switch security_inode_getattr() to struct path *
  constify tomoyo_realpath_from_path()
  ...
2015-04-14 15:31:03 -07:00
Al Viro a555ad450f whack-a-mole: no need to set_fs(USER_DS) in {start,flush}_thread()
flush_old_exec() has already done that.  Back on 2011 a bunch of
instances like that had been kicked out, but that hadn't taken
care of then-out-of-tree architectures, obviously, and they served
as reinfection vector...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-04-11 22:24:31 -04:00
Ley Foon Tan 4a89c3088f nios2: fix cache coherency issue when debug with gdb
Remove the end address checking for flushda function. We need to flush
each address line for flushda instruction, from start to end address.
This is because flushda instruction only flush the cache if tag and line
fields are matched.

Change to use ldwio instruction (bypass cache) to load the instruction
that causing trap. Our interest is the actual instruction that executed
by the processor, this should be uncached.
Note, EA address might be an userspace cached address.


Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-10 11:10:08 +08:00
Ley Foon Tan 7587d12647 nios2: signal: Move restart_block to struct task_struct
See https://lkml.org/lkml/2014/10/29/643 and commit f56141e3e2
("all arches, signal: move restart_block to struct task_struct")

Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-08 13:45:16 +08:00
Chung-Ling Tang 92d5dd8cd6 nios2: update pt_regs
Remove struct pt_regs from user header and use generic ucontext.h.

Signed-off-by: Chung-Ling Tang <cltang@codesourcery.com>
Acked-by: Ley Foon Tan <lftan@altera.com>
2015-03-12 13:35:06 +08:00
Ley Foon Tan d16d2be111 nios2: add kgdb support
Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-02-16 19:26:43 +08:00
Ley Foon Tan e8bf5bc776 nios2: add early printk support
Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-02-10 23:21:08 +08:00
Linus Torvalds fcb237317f nios2 fixes for v3.19-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.5 (GNU/Linux)
 
 iQIVAwUAVMDAS1WoEK+e3syCAQJB7A//SBSV6rbvPRhHddkzsBlAT2+saTkSJytz
 OG763mRDKFT5QbB30ClAXiNVMqvMK/C+++vnRkL5Nklp8ogPyOxlOS2JnYF77R55
 C6ekQbntQtlcq8X9pbFXSSexxhTbFWPW6YBgb2zenQWQqTkmI3mZ4uTa5f+uB4DK
 tnGNyY5SP6t1TLbM5oI0JOstcPwaDxH/s5+WeA+5Kutcc3m1W/xFu9po+XMGdjxy
 KT76a5uTMfzKtnGw5EjbtPuBoSU8MqBCZKg/BoDpyvkFLMD/s7fakiSJ6MZHBrDy
 Ov1ExP2WdC4s+jy9yFLfOSp3xSjKGicnUTuuUp1hI9blpOqmoTjivXITP1xeDtPg
 FWohBO/TqerROdH85b4seXj5BMgnrR58WaNK0RblIJSpTBzqDTsZRwcl348fWdvp
 LArsiCdgs14NtacrYng47nsi9Ys/pnGVHP7pdM53RY818qsei3ODv5Oba95n2pjW
 Qgv2CdkWlGY8dGQaPe61D6XapFQKctMy9HYi7Pou/n96510SHT2nJ5MWDjwa971i
 zF+xBbvbtsidUcJrYqslzAMGEBfH0CHAhEwpZjal3HfB9RjpdMrQSc7xggce/Brb
 DOSsNeFmnvkaYFhYjnstfn1Hf9Iz1H0KRaw3H0EgNq2qpV9WunfQ94HaQnNcV7Z0
 ZZZ0RyyJtaA=
 =ZFRY
 -----END PGP SIGNATURE-----

Merge tag 'nios2-fixes-v3.19-rc6' of git://git.rocketboards.org/linux-socfpga-next

Pull one arch/nios2 fix from Ley Foon Tan:
 "Fix kuser trampoline address"

* tag 'nios2-fixes-v3.19-rc6' of git://git.rocketboards.org/linux-socfpga-next:
  nios2: fix kuser trampoline address
2015-01-23 06:52:14 +12:00