Re: fs/notify/fanotify/fanotify.c:198:2: note: in expansion of macro 'pr_warn_ratelimited'

2019-03-14 Thread Ralf Baechle
On Thu, Mar 14, 2019 at 01:38:11PM +0100, Jan Kara wrote:

> On Thu 14-03-19 14:01:18, Amir Goldstein wrote:
> > On Thu, Mar 14, 2019 at 10:37 AM Jan Kara  wrote:
> > >
> > > AFAICS this is the known problem with weird mips definitions of
> > > __kernel_fsid_t which uses long whereas all other architectures use int,
> > > right? Seeing that mips can actually have 8-byte longs, I guess this
> > > bogosity is just wired in the kernel API and we cannot easily fix it in
> > > mips (mips guys, correct me if I'm wrong). So what if we just
> > > unconditionally typed printed values to unsigned int to silence the
> > > warning?
> > 
> > I don't understand why. To me that sounds like papering over a bug.
> > 
> > See this reply from mips developer Paul Burton:
> > https://marc.info/?l=linux-fsdevel&m=154783680019904&w=2
> > mips developers have not replied to the question why __kernel_fsid_t
> > should use long.
> 
> Ah, right. I've missed that mips defines __kernel_fsid_t only if
> sizeof(long) == 4. OK, than fixing MIPS headers is definitely what we ought
> to do. Mips guys, any reason why the patch from Ralf didn't get merged yet?

Paul's patch :-)

As for the reason why the definition is as it is - 32-bit MIPS was
born using long, then in 2000 64-bit MIPS started off as arch/mips64
using int.  Eventually the two ports were combined using:

ypedef struct {
#if (_MIPS_SZLONG == 32)
longval[2];
#endif
#if (_MIPS_SZLONG == 64)
int val[2];
#endif
} __kernel_fsid_t;

A desparate attempt to use asm-generic where ever possible then resulted
in the confusing definition we'e having today.

Normally APIs are cast into stone not to be changed.  But fsid is used in
struct statfs and the man page states "Nobody knows what f_fsid is supposed
to contain (but see below)." and f_fsid is supposed to be opaque anyway so
I'm wondering if something could break at all.  Researching that.

  Ralf


Re: [PATCH] MIPS: Remove no-op cast in show_regs()

2018-07-02 Thread Ralf Baechle
On Fri, Jun 22, 2018 at 11:07:03AM -0700, Paul Burton wrote:

> In show_regs() we have a regs argument of type struct pt_regs *, and we
> explicitly cast it to that same type as part of calling __show_regs().
> 
> Casting regs to the same type that it is declared as does nothing at
> all, so remove the useless cast.

Good catch but there's no dump_stack() in v4.18-rc3 so this doesn't apply.
That's trivial to patch up but since pointless casts are one of my pet
peeve I used a semantic patch from a dark local repository to hunt down a
few more.

@identitycast@
type T;
T *A;
@@
-   (T *) A
+   A

Julia, I guess this isn't bulletproof but maybe something similar should
be considered for scripts/coccinelle?

  Ralf

Signed-off-by: Ralf Baechle 

 arch/mips/kernel/relocate.c   |  2 +-
 arch/mips/kernel/traps.c  |  2 +-
 arch/mips/loongson64/loongson-3/smp.c | 10 +-
 arch/mips/pmcs-msp71xx/msp_usb.c  |  4 ++--
 arch/mips/sgi-ip22/ip28-berr.c|  2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index cbf4cc0b0b6c..ae7d9cf2c849 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -146,7 +146,7 @@ int __init do_relocations(void *kbase_old, void *kbase_new, 
long offset)
break;
 
type = (*r >> 24) & 0xff;
-   loc_orig = (void *)(kbase_old + ((*r & 0x00ff) << 2));
+   loc_orig = (kbase_old + ((*r & 0x00ff) << 2));
loc_new = RELOCATED(loc_orig);
 
if (reloc_handlers_rel[type] == NULL) {
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index d67fa74622ee..2935aa608d2f 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -350,7 +350,7 @@ static void __show_regs(const struct pt_regs *regs)
  */
 void show_regs(struct pt_regs *regs)
 {
-   __show_regs((struct pt_regs *)regs);
+   __show_regs(regs);
 }
 
 void show_registers(struct pt_regs *regs)
diff --git a/arch/mips/loongson64/loongson-3/smp.c 
b/arch/mips/loongson64/loongson-3/smp.c
index 8501109bb0f0..e231c2cb4a64 100644
--- a/arch/mips/loongson64/loongson-3/smp.c
+++ b/arch/mips/loongson64/loongson-3/smp.c
@@ -349,7 +349,7 @@ static void loongson3_smp_finish(void)
write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
local_irq_enable();
loongson3_ipi_write64(0,
-   (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x0));
+   (ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0));
pr_info("CPU#%d finished, CP0_ST=%x\n",
smp_processor_id(), read_c0_status());
 }
@@ -416,13 +416,13 @@ static int loongson3_boot_secondary(int cpu, struct 
task_struct *idle)
cpu, startargs[0], startargs[1], startargs[2]);
 
loongson3_ipi_write64(startargs[3],
-   (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x18));
+   (ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x18));
loongson3_ipi_write64(startargs[2],
-   (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x10));
+   (ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x10));
loongson3_ipi_write64(startargs[1],
-   (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x8));
+   (ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x8));
loongson3_ipi_write64(startargs[0],
-   (void *)(ipi_mailbox_buf[cpu_logical_map(cpu)]+0x0));
+   (ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0));
return 0;
 }
 
diff --git a/arch/mips/pmcs-msp71xx/msp_usb.c b/arch/mips/pmcs-msp71xx/msp_usb.c
index c87c5f810cd1..d38ac70b5a2e 100644
--- a/arch/mips/pmcs-msp71xx/msp_usb.c
+++ b/arch/mips/pmcs-msp71xx/msp_usb.c
@@ -133,13 +133,13 @@ static int __init msp_usb_setup(void)
 * "D" for device-mode.  If it works for Ethernet, why not USB...
 *  -- hammtrev, 2007/03/22
 */
-   snprintf((char *)&envstr[0], sizeof(envstr), "usbmode");
+   snprintf(&envstr[0], sizeof(envstr), "usbmode");
 
/* set default host mode */
val = 1;
 
/* get environment string */
-   strp = prom_getenv((char *)&envstr[0]);
+   strp = prom_getenv(&envstr[0]);
if (strp) {
/* compare string */
if (!strcmp(strp, "device"))
diff --git a/arch/mips/sgi-ip22/ip28-berr.c b/arch/mips/sgi-ip22/ip28-berr.c
index 2ed8e4990b7a..082541d33161 100644
--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -464,7 +464,7 @@ void ip22_be_interrupt(int irq)
die_if_kernel("Oops", regs);
force_sig(SIGBUS, current);
} else if (debug_be_interru

Re: [RFC PATCH] MIPS: Oprofile: Drop support

2018-05-04 Thread Ralf Baechle
On Fri, May 04, 2018 at 02:27:51PM +0200, Robert Richter wrote:

> On 04.05.18 12:03:12, Matt Redfearn wrote:
> > >As said, oprofile version 0.9.x is still available for cpus that do
> > >not support perf. What is the breakage?
> > 
> > The breakage I originally set out to fix was the MT support in perf.
> > https://www.linux-mips.org/archives/linux-mips/2018-04/msg00259.html
> > 
> > Since the perf code shares so much copied code from oprofile, those same
> > issues exist in oprofile and ought to be addressed. But as newer oprofile
> > userspace does not use the (MIPS) kernel oprofile code, then we could,
> > perhaps, just remove it (as per the RFC). That would break legacy tools
> > (0.9.x) though...
> 
> Those support perf:
> 
>  (CPU_MIPS32 || CPU_MIPS64 || CPU_R1 || CPU_SB1 || CPU_CAVIUM_OCTEON || 
> CPU_XLP || CPU_LOONGSON3)
> 
> Here is the total list of CPU_*:
> 
>  $ git grep -h config.CPU_ arch/mips/ | sort -u | wc -l
>  79
> 
> The comparisation might not be accurate, but at least gives a hint
> that there are many cpus not supporting perf. You would drop profiling
> support at al to them.

The grep results are a bit missleading.  We have many symbols such as
CPU_MIPS32_R1 which describe a particular architecture revision supported
by a CPU.  Others CPU_* symbols are describing particular features or
options so in reality there are far fewer CPU to be supported.  Also
many of the older processors or embedded cores don't have performance
counters at all; for yet other cores presence, number and a few other
details can be configured when synthesizing the RTL so relying on the
CONFIG_* alone won't help.

> If it is too hard to also fix the oprofile code (code duplication
> seems the main issue here), then it would be also ok to blacklist
> newer cpus to enable oprofile kernel code (where it is broken).

  Ralf


Re: [PATCH v5 1/5] MIPS: Lonngson64: Copy kernel command line from arcs_cmdline

2017-12-20 Thread Ralf Baechle
On Sat, Dec 16, 2017 at 10:57:47PM +0800, Jiaxun Yang wrote:

> Since lemote-2f/marchtype.c need to get cmdline from loongson.h
> this patch simply copy kernel command line from arcs_cmdline
> to fix that issue

Sorry, I don't quite understand.

Is the issue that arcs_cmdline[] is declared as __initdata in
arch/mips/kernel/setup.c?

Note that it's ok to use arcs_cmdline on a non-ARCS machine.  ARC systems
were the first systems supported by Linux/MIPS, that's how the variable
got its name; the name was just never properly cleaned up but probably
should.

  Ralf


Re: [PATCH v5 5/5] MAINTAINERS: Add entry for Lemote YeeLoong Extra Driver

2017-12-20 Thread Ralf Baechle
On Sat, Dec 16, 2017 at 10:57:51PM +0800, Jiaxun Yang wrote:
> Date:   Sat, 16 Dec 2017 22:57:51 +0800
> From: Jiaxun Yang 
> To: James Hogan 
> Cc: Ralf Baechle , linux-m...@linux-mips.org, Huacai
>  Chan , linux-kernel@vger.kernel.org, Jiaxun Yang
>  
> Subject: [PATCH v5 5/5] MAINTAINERS: Add entry for Lemote YeeLoong Extra
>  Driver
> 
> Add myself as a maintainer of Lemote YeeLoong Extra driver
> 
> Signed-off-by: Jiaxun Yang 
> ---
>  MAINTAINERS | 6 ++
>  1 file changed, 6 insertions(+)
>  mode change 100644 => 100755 MAINTAINERS
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> old mode 100644
> new mode 100755
> index cdd6365a59d9..d2de627828a0
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7890,6 +7890,12 @@ W: http://legousb.sourceforge.net/
>  S:   Maintained
>  F:   drivers/usb/misc/legousbtower.c
>  
> +Lemote YeeLoong EXTRAS DRIVER
> +M:   Jiaxun Yang 
> +S:   Maintained
> +F:   drivers/platform/mips/yeeloong_laptop.c

Hmm...  That's a very short entry.  I think at the very least an entry
for a mailing list should be added.

  Ralf


Re: [PATCH v2 0/6] MIPS: NT_PRFPREG regset handling fixes

2017-12-12 Thread Ralf Baechle
Thanks, applied.

  Ralf


Re: [PATCH] MIPS: ath25: Avoid undefined early_serial_setup() without SERIAL_8250_CONSOLE

2017-11-14 Thread Ralf Baechle
On Tue, Nov 14, 2017 at 01:29:17PM +, Matt Redfearn wrote:

> Currently MIPS allnoconfig with CONFIG_ATH25=y fails to link due to
> missing support for early_serial_setup():
> 
>   LD  vmlinux
> arch/mips/ath25/devices.o: In function ath25_serial_setup':
> devices.c:(.init.text+0x68): undefined reference to 'early_serial_setup'
> 
> Rather than adding dependencies to the platform to force inclusion of
> SERIAL_8250_CONSOLE together with it's dependencies like TTY, HAS_IOMEM,
> etc, just make ath25_serial_setup() a no-op when the dependency is not
> selected in the kernel config.

Looks like arch/mips/rb532/serial.c might be suffering from the same
issue?

  Ralf


Re: [PATCH] watchdog: indydog: Add dependency on SGI_HAS_INDYDOG

2017-11-14 Thread Ralf Baechle
On Tue, Nov 14, 2017 at 11:17:38AM +, James Hogan wrote:

> On Tue, Nov 14, 2017 at 10:52:54AM +, Matt Redfearn wrote:
> > Commit da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
> > enabled building the Indy watchdog driver when COMPILE_TEST is enabled.
> > However, the driver makes reference to symbols that are only defined for
> > certain platforms are selected in the config. These platforms select
> > SGI_HAS_INDYDOG. Without this, link time errors result, for example
> > when building a MIPS allyesconfig.
> > 
> > drivers/watchdog/indydog.o: In function `indydog_write':
> > indydog.c:(.text+0x18): undefined reference to `sgimc'
> > indydog.c:(.text+0x1c): undefined reference to `sgimc'
> > drivers/watchdog/indydog.o: In function `indydog_start':
> > indydog.c:(.text+0x54): undefined reference to `sgimc'
> > indydog.c:(.text+0x58): undefined reference to `sgimc'
> > drivers/watchdog/indydog.o: In function `indydog_stop':
> > indydog.c:(.text+0xa4): undefined reference to `sgimc'
> > drivers/watchdog/indydog.o:indydog.c:(.text+0xa8): more undefined
> > references to `sgimc' follow
> > make: *** [Makefile:1005: vmlinux] Error 1
> > 
> > Fix this by ensuring that CONFIG_INDIDOG can only be selected when the
> > necessary dependent platform symbols are built in.
> > 
> > Fixes: da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
> > Signed-off-by: Matt Redfearn 
> > Cc:  # 4.11 +
> > ---
> > 
> >  drivers/watchdog/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > index ca200d1f310a..d96e2e7544fc 100644
> > --- a/drivers/watchdog/Kconfig
> > +++ b/drivers/watchdog/Kconfig
> > @@ -1451,7 +1451,7 @@ config RC32434_WDT
> >  
> >  config INDYDOG
> > tristate "Indy/I2 Hardware Watchdog"
> > -   depends on SGI_HAS_INDYDOG || (MIPS && COMPILE_TEST)
> > +   depends on SGI_HAS_INDYDOG || (MIPS && COMPILE_TEST && SGI_HAS_INDYDOG)
> 
> (MIPS && COMPILE_TEST && SGI_HAS_INDYDOG) implies SGI_HAS_INDYDOG
> 
> So I think you can just do:
> - depends on SGI_HAS_INDYDOG || (MIPS && COMPILE_TEST)
> + depends on SGI_HAS_INDYDOG
> 
> I.e. COMPILE_TEST isn't of any value in this case.

I agree, due to the references to sgimc this driver will only compile for
the platforms which set SGI_HAS_INDYDOG; MIPS as the dependency is too
generic.

Updated patch for the watchdog maintainers' ease below.

  Ralf

Signed-off-by: Ralf Baechle 
Reported-by: Matt Redfearn 
Suggested-by: James Hogan 

 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index c722cbfdc7e6..3ece1335ba84 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1451,7 +1451,7 @@ config RC32434_WDT
 
 config INDYDOG
tristate "Indy/I2 Hardware Watchdog"
-   depends on SGI_HAS_INDYDOG || (MIPS && COMPILE_TEST)
+   depends on SGI_HAS_INDYDOG
help
  Hardware driver for the Indy's/I2's watchdog. This is a
  watchdog timer that will reboot the machine after a 60 second


Re: [PATCH 3/4] MIPS: Loongson64: Yeeloong add platform driver Yeeloong is a laptop with a MIPS Loongson 2F processor, AMD CS5536 chipset, and KB3310B controller.

2017-11-14 Thread Ralf Baechle
On Sun, Nov 12, 2017 at 02:36:16PM +0800, jiaxun.y...@flygoat.com wrote:

> + asm(".set noreorder\n");
> + /*  input enable */
> + outl(0x0800, (gpio_base | 0xA0));
> + /*  revert the input */
> + outl(0x0800, (gpio_base | 0xA4));
> + /*  event-int enable */
> + outl(0x0800, (gpio_base | 0xB8));
> + asm(".set reorder\n");

I forgot to comment on this .set noreorder thing.  GCC expects gas to be
in reorder mode at the end of every bit of inline assembler, so above
code is at the mercy of GCC.

Not sure what the intent was here, was it to avoid GCC from reordering
the outl() calls?  These are already marked volatlile and should not be
reordered by GCC.  .set (no)reorder on the other hand is a directive
to GAS and GCC won't be influenced at all by it.

Cheers,

  Ralf



Re: [PATCH 4/4] MIPS: Loongson64: Load platform device during boot This patch just add pdev during boot to load the platform driver

2017-11-14 Thread Ralf Baechle
On Sun, Nov 12, 2017 at 02:36:17PM +0800, jiaxun.y...@flygoat.com wrote:

> From: Jiaxun Yang 
> 
> Signed-off-by: Jiaxun Yang 
> ---
>  arch/mips/loongson64/lemote-2f/Makefile   |  2 +-
>  arch/mips/loongson64/lemote-2f/platform.c | 45 
> +++
>  2 files changed, 46 insertions(+), 1 deletion(-)
>  create mode 100644 arch/mips/loongson64/lemote-2f/platform.c
> 
> diff --git a/arch/mips/loongson64/lemote-2f/Makefile 
> b/arch/mips/loongson64/lemote-2f/Makefile
> index 08b8abcbfef5..31c90737b98c 100644
> --- a/arch/mips/loongson64/lemote-2f/Makefile
> +++ b/arch/mips/loongson64/lemote-2f/Makefile
> @@ -2,7 +2,7 @@
>  # Makefile for lemote loongson2f family machines
>  #
>  
> -obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o
> +obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o platform.o
>  
>  #
>  # Suspend Support
> diff --git a/arch/mips/loongson64/lemote-2f/platform.c 
> b/arch/mips/loongson64/lemote-2f/platform.c
> new file mode 100644
> index ..c36efcccb9a9
> --- /dev/null
> +++ b/arch/mips/loongson64/lemote-2f/platform.c
> @@ -0,0 +1,45 @@
> +/*
> + * Copyright (C) 2017 Jiaxun Yang.
> + * Author: Jiaxun Yang, jiaxun.y...@flygoat.com
> +
> + * Copyright (C) 2009 Lemote Inc.
> + * Author: Wu Zhangjin, wuzhang...@gmail.com
> + *
> + * This program is free software; you can redistribute  it and/or modify it
> + * under  the terms of  the GNU General  Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +#include 
> +#include 
> +
> +#include 
> +
> +static struct platform_device yeeloong_pdev = {
> + .name = "yeeloong_laptop",
> + .id = -1,
> +};
> +
> +
> +static int __init lemote2f_platform_init(void)
> +{
> + struct platform_device *pdev = NULL;
> +
> + switch (mips_machtype) {
> + case MACH_LEMOTE_YL2F89:
> + pdev = &yeeloong_pdev;
> + break;
> +
> + default:
> + break;
> +
> + }
> +
> + if (pdev != NULL)
> + return platform_device_register(pdev);
> +
> + return -ENODEV;
> +}
> +
> +arch_initcall(lemote2f_platform_init);

Looks like you can simplify this by using something like:

> +static int __init lemote2f_platform_init(void)
> +{
> + struct platform_device *pdev = NULL;
> +
> + switch (mips_machtype) {
> + case MACH_LEMOTE_YL2F89:
> + pdev = &yeeloong_pdev;
> + break;
> +
> + default:
> + break;
> +
> + }
> +
> + if (pdev != NULL)
> + return platform_device_register(pdev);
> +
> + return -ENODEV;
> +}

Looks like this can be simplified to:

static int __init lemote2f_platform_init(void)
{
if (mips_machtype != MACH_LEMOTE_YL2F89)
return -ENODEV;

return platform_device_register_simple("yeeloong_laptop", -1, NULL, 0);
}


  Ralf


Re: [PATCH 3/4] MIPS: Loongson64: Yeeloong add platform driver Yeeloong is a laptop with a MIPS Loongson 2F processor, AMD CS5536 chipset, and KB3310B controller.

2017-11-14 Thread Ralf Baechle
On Sun, Nov 12, 2017 at 02:36:16PM +0800, jiaxun.y...@flygoat.com wrote:
> Date:   Sun, 12 Nov 2017 14:36:16 +0800
> From: jiaxun.y...@flygoat.com
> To: r...@linux-mips.org
> Cc: linux-m...@linux-mips.org, linux-kernel@vger.kernel.org, Jiaxun Yang
>  
> Subject: [PATCH 3/4] MIPS: Loongson64: Yeeloong add platform driver
>  Yeeloong is a laptop with a MIPS Loongson 2F processor, AMD CS5536
>  chipset, and KB3310B controller.
> Content-Type: text/plain; charset=UTF-8

Some comment as for the previous patch:

Please don't cram the entire commit message into the subject line.  The
standard for commit messages to keep lines only so long that when you
look at them in "git log" in a 80 column terminal they don't get line
wrapped or truncated.

> From: Jiaxun Yang 
> 
> This yeeloong_laptop module enables access to sensors, battery,
> video camera switch, external video connector event, and some
> additional buttons.
> 
> This driver was orginally from linux-loongson-community. I Just do
> some clean up and port to mainline kernel tree.
> 
> Signed-off-by: Jiaxun Yang 
> ---
>  drivers/platform/mips/Kconfig   |   18 +
>  drivers/platform/mips/Makefile  |3 +
>  drivers/platform/mips/yeeloong_laptop.c | 1143 
> +++
>  3 files changed, 1164 insertions(+)
>  create mode 100644 drivers/platform/mips/yeeloong_laptop.c
> 
> diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig
> index b3ae30a4c67b..0f054efc26e3 100644
> --- a/drivers/platform/mips/Kconfig
> +++ b/drivers/platform/mips/Kconfig
> @@ -23,4 +23,22 @@ config CPU_HWMON
>   help
> Loongson-3A/3B CPU Hwmon (temperature sensor) driver.
>  
> +config LEMOTE_YEELOONG2F
> + tristate "Lemote YeeLoong Laptop"
> + depends on LEMOTE_MACH2F
> + select BACKLIGHT_LCD_SUPPORT
> + select LCD_CLASS_DEVICE
> + select BACKLIGHT_CLASS_DEVICE
> + select POWER_SUPPLY
> + select HWMON
> + select INPUT_SPARSEKMAP
> + select INPUT_EVDEV
> + depends on INPUT
> + default m
> + help
> +   YeeLoong netbook is a mini laptop made by Lemote, which is basically
> +   compatible to FuLoong2F mini PC, but it has an extra Embedded
> +   Controller(kb3310b) for battery, hotkey, backlight, temperature and
> +   fan management.

Please don't depend on INPUT, it's going to drive users crazy because
mortals less familiar with the configuration process for this platform
almost certainly won't know that INPUT needs to be enabled so
LEMOTE_YEELOONG2F can be selected.

This will require further changes because you can't force INPUT_SPARSEKMAP
and INPUT_EVDEV on if you don't know INPUT is selected.

It also looks as if your Kconfig changes won't work properly if INPUT_MISC
has not been selected manually.

>  endif # MIPS_PLATFORM_DEVICES
> diff --git a/drivers/platform/mips/Makefile b/drivers/platform/mips/Makefile
> index 8dfd03924c37..b3172b081a2f 100644
> --- a/drivers/platform/mips/Makefile
> +++ b/drivers/platform/mips/Makefile
> @@ -1 +1,4 @@
>  obj-$(CONFIG_CPU_HWMON) += cpu_hwmon.o
> +
> +obj-$(CONFIG_LEMOTE_YEELOONG2F)  += yeeloong_laptop.o
> +CFLAGS_yeeloong_laptop.o = -I$(srctree)/arch/mips/loongson/lemote-2f
> diff --git a/drivers/platform/mips/yeeloong_laptop.c 
> b/drivers/platform/mips/yeeloong_laptop.c
> new file mode 100644
> index ..280f2044858b
> --- /dev/null
> +++ b/drivers/platform/mips/yeeloong_laptop.c
> @@ -0,0 +1,1143 @@
> +/*
> + * Driver for YeeLoong laptop extras
> + *
> + *  Copyright (C) 2017 Jiaxun Yang.
> + *  Author: Jiaxun Yang 
> + *
> + *  Copyright (C) 2009 Lemote Inc.
> + *  Author: Wu Zhangjin , Liu Junliang 
> 
> + *
> + *  Fixes: Petr Pisar , 2012, 2013, 2014, 2015.
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License version 2 as
> + *  published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include  /* for backlight subdriver */
> +#include 
> +#include  /* for hwmon subdriver */
> +#include 
> +#include/* for clamp_val() */
> +#include  /* for hotkey subdriver */
> +#include 
> +#include 
> +#include 
> +#include   /* for AC & Battery subdriver */
> +#include/* For MODULE_DEVICE_TABLE() */
> +
> +#include 
> +
> +#include 
> +
> +#include /* for loongson_cmdline */
> +#include 
> +
> +/* common function */
> +#define EC_VER_LEN 64
> +
> +static int ec_version_before(char *version)
> +{
> + char *p, ec_ver[EC_VER_LEN];
> +
> + p = strstr(loongson_cmdline, "EC_VER=");
> + if (!p)
> + memset(ec_ver, 0, EC_VER_LEN);
> + else {
> + strncpy(ec_ver, p, EC_VER_LEN);
> + p = strstr(ec_ver, " ");
> + if (p)
> + *p = '\0';
> + }
> +
> + return (strncasecmp(ec_ver, version, 64) < 0);
> +}
> +
> +/* backlight subdriver */
> +#define MAX_BRIGHTNESS   8
> +
> +static int y

Re: [PATCH 2/4] MIPS: Loongson64: lemote-2f move ec_kb3310b.h to include dir and clean up To operate EC from platform driver, this head file need able to be include from anywhere. This patch just move

2017-11-13 Thread Ralf Baechle
On Sun, Nov 12, 2017 at 02:36:15PM +0800, jiaxun.y...@flygoat.com wrote:
> Date:   Sun, 12 Nov 2017 14:36:15 +0800
> From: jiaxun.y...@flygoat.com
> To: r...@linux-mips.org
> Cc: linux-m...@linux-mips.org, linux-kernel@vger.kernel.org, Jiaxun Yang
>  
> Subject: [PATCH 2/4] MIPS: Loongson64: lemote-2f move ec_kb3310b.h to
>  include dir and clean up To operate EC from platform driver, this head
>  file need able to be include from anywhere. This patch just move
>  ec_kb3310b.h to include dir and clean up ec_kb3310b.h.

Some comment as for the previous patch:

Please don't cram the entire commit message into the subject line.  The
standard for commit messages to keep lines only so long that when you
look at them in "git log" in a 80 column terminal they don't get line
wrapped or truncated.

> From: Jiaxun Yang 
> 
> Signed-off-by: Jiaxun Yang 
> ---
>  arch/mips/include/asm/mach-loongson64/ec_kb3310b.h | 170 +++
>  arch/mips/loongson64/lemote-2f/ec_kb3310b.c|   2 +-
>  arch/mips/loongson64/lemote-2f/ec_kb3310b.h| 188 
> -
>  arch/mips/loongson64/lemote-2f/pm.c|   4 +-
>  arch/mips/loongson64/lemote-2f/reset.c |   4 +-
>  5 files changed, 175 insertions(+), 193 deletions(-)
>  create mode 100644 arch/mips/include/asm/mach-loongson64/ec_kb3310b.h
>  delete mode 100644 arch/mips/loongson64/lemote-2f/ec_kb3310b.h

When preparing patches for submission please use the git diff option -M
which will make git-diff detect files being moved around and produce a much
smaller, easier to review diff file.

> diff --git a/arch/mips/include/asm/mach-loongson64/ec_kb3310b.h 
> b/arch/mips/include/asm/mach-loongson64/ec_kb3310b.h
> new file mode 100644
> index ..2e8690532ea5
> --- /dev/null
> +++ b/arch/mips/include/asm/mach-loongson64/ec_kb3310b.h
> @@ -0,0 +1,170 @@
> +/*
> + * KB3310B Embedded Controller
> + *
> + *  Copyright (C) 2008 Lemote Inc.
> + *  Author: liujl , 2008-03-14
> + *  Copyright (C) 2009 Lemote Inc.
> + *  Author: Wu Zhangjin 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef _EC_KB3310B_H
> +#define _EC_KB3310B_H
> +
> +extern unsigned char ec_read(unsigned short addr);
> +extern void ec_write(unsigned short addr, unsigned char val);
> +extern int ec_query_seq(unsigned char cmd);
> +extern int ec_query_event_num(void);
> +extern int ec_get_event_num(void);
> +
> +typedef int (*sci_handler) (int status);
> +extern sci_handler yeeloong_report_lid_status;
> +
> +#define ON   1
> +#define OFF  0
> +
> +#define SCI_IRQ_NUM 0x0A
> +
> +/*
> + * The following registers are determined by the EC index configuration.
> + * 1, fill the PORT_HIGH as EC register high part.
> + * 2, fill the PORT_LOW as EC register low part.
> + * 3, fill the PORT_DATA as EC register write data or get the data from it.
> + */
> +#define  EC_IO_PORT_HIGH 0x0381
> +#define  EC_IO_PORT_LOW  0x0382
> +#define  EC_IO_PORT_DATA 0x0383
> +
> +/*
> + * EC delay time is 500us for register and status access
> + */
> +#define  EC_REG_DELAY500 /* unit : us */
> +#define  EC_CMD_TIMEOUT  0x1000
> +
> +/*
> + * EC access port for SCI communication
> + */
> +#define  EC_CMD_PORT 0x66
> +#define  EC_STS_PORT 0x66
> +#define  EC_DAT_PORT 0x62
> +#define  CMD_INIT_IDLE_MODE  0xdd
> +#define  CMD_EXIT_IDLE_MODE  0xdf
> +#define  CMD_INIT_RESET_MODE 0xd8
> +#define  CMD_REBOOT_SYSTEM   0x8c
> +#define  CMD_GET_EVENT_NUM   0x84
> +#define  CMD_PROGRAM_PIECE   0xda
> +
> +/* Temperature & Fan registers */
> +#define  REG_TEMPERATURE_VALUE   0xF458
> +#define  REG_FAN_AUTO_MAN_SWITCH 0xF459
> +#define  BIT_FAN_AUTO0
> +#define  BIT_FAN_MANUAL  1
> +#define  REG_FAN_CONTROL 0xF4D2
> +#define  REG_FAN_STATUS  0xF4DA
> +#define  REG_FAN_SPEED_HIGH  0xFE22
> +#define  REG_FAN_SPEED_LOW   0xFE23
> +#define  REG_FAN_SPEED_LEVEL 0xF4CC
> +/* Fan speed divider */
> +#define  FAN_SPEED_DIVIDER   48  /* (60*1000*1000/62.5/2)*/
> +
> +/* Battery registers */
> +#define  REG_BAT_DESIGN_CAP_HIGH 0xF77D
> +#define  REG_BAT_DESIGN_CAP_LOW  0xF77E
> +#define  REG_BAT_FULLCHG_CAP_HIGH0xF780
> +#define  REG_BAT_FULLCHG_CAP_LOW 0xF781
> +#define  REG_BAT_DESIGN_VOL_HIGH 0xF782
> +#define  REG_BAT_DESIGN_VOL_LOW  0xF783
> +#define  REG_BAT_CURRENT_HIGH0xF784
> +#define  REG_BAT_CURRENT_LOW 0xF785
> +#define  REG_BAT_VOLTAGE_HIGH0xF786
> +#define  REG_BAT_VOLTAGE_LOW 0xF787
> +#define  REG_BAT_T

Re: [PATCH 1/4] MIPS: Lonngson64: Copy kernel command line from arcs_cmdline Since lemte-2f/marchtype.c need to get cmdline from loongson.h this patch simply copy kernel command line from arcs_cmdline

2017-11-13 Thread Ralf Baechle
On Sun, Nov 12, 2017 at 02:36:14PM +0800, jiaxun.y...@flygoat.com wrote:
> Date:   Sun, 12 Nov 2017 14:36:14 +0800
> From: jiaxun.y...@flygoat.com
> To: r...@linux-mips.org
> Cc: linux-m...@linux-mips.org, linux-kernel@vger.kernel.org, Jiaxun Yang
>  
> Subject: [PATCH 1/4] MIPS: Lonngson64: Copy kernel command line from
>  arcs_cmdline Since lemte-2f/marchtype.c need to get cmdline from
>  loongson.h this patch simply copy kernel command line from arcs_cmdline to
>  fix that issue

Please don't cram the entire commit message into the subject line.  The
standard for commit messages to keep lines only so long that when you
look at them in "git log" in a 80 column terminal they don't get line
wrapped or truncated.

And what is "lemte-2f/marchtype.c"?  Maybe you meant lemote-2f/machtype.c?

> From: Jiaxun Yang 
> 
> Signed-off-by: Jiaxun Yang 
> ---
>  arch/mips/include/asm/mach-loongson64/loongson.h | 6 ++
>  arch/mips/loongson64/common/cmdline.c| 7 +++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/arch/mips/include/asm/mach-loongson64/loongson.h 
> b/arch/mips/include/asm/mach-loongson64/loongson.h
> index c68c0cc879c6..1edf3a484e6a 100644
> --- a/arch/mips/include/asm/mach-loongson64/loongson.h
> +++ b/arch/mips/include/asm/mach-loongson64/loongson.h
> @@ -45,6 +45,12 @@ static inline void prom_init_uart_base(void)
>  #endif
>  }
>  
> +/*
> + * Copy kernel command line from arcs_cmdline
> + */
> +#include 

Please group #include lines at the top of the file.

> +extern char loongson_cmdline[COMMAND_LINE_SIZE];
> +
>  /* irq operation functions */
>  extern void bonito_irqdispatch(void);
>  extern void __init bonito_irq_init(void);
> diff --git a/arch/mips/loongson64/common/cmdline.c 
> b/arch/mips/loongson64/common/cmdline.c
> index 01fbed137028..49e172184e15 100644
> --- a/arch/mips/loongson64/common/cmdline.c
> +++ b/arch/mips/loongson64/common/cmdline.c
> @@ -21,6 +21,11 @@
>  
>  #include 
>  
> +/* the kernel command line copied from arcs_cmdline */
> +#include 
> +char loongson_cmdline[COMMAND_LINE_SIZE];
> +EXPORT_SYMBOL(loongson_cmdline);
> +
>  void __init prom_init_cmdline(void)
>  {
>   int prom_argc;
> @@ -45,4 +50,6 @@ void __init prom_init_cmdline(void)
>   }
>  
>   prom_init_machtype();
> + /* copy arcs_cmdline into loongson_cmdline */
> + strncpy(loongson_cmdline, arcs_cmdline, COMMAND_LINE_SIZE);
>  }

  Ralf


Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER

2017-10-09 Thread Ralf Baechle
On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote:

> Subject: [PATCH 10/13] timer: Remove expires and data arguments from
>  DEFINE_TIMER
> 
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
> $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook 
> Acked-by: Geert Uytterhoeven  # for m68k parts
> ---
>  arch/arm/mach-ixp4xx/dsmg600-setup.c  | 2 +-
>  arch/arm/mach-ixp4xx/nas100d-setup.c  | 2 +-
>  arch/m68k/amiga/amisound.c| 2 +-
>  arch/m68k/mac/macboing.c  | 2 +-
>  arch/mips/mti-malta/malta-display.c   | 2 +-
>  arch/parisc/kernel/pdc_cons.c | 2 +-
>  arch/s390/mm/cmm.c| 2 +-
>  drivers/atm/idt77105.c| 4 ++--
>  drivers/atm/iphase.c  | 2 +-
>  drivers/block/ataflop.c   | 8 
>  drivers/char/dtlk.c   | 2 +-
>  drivers/char/hangcheck-timer.c| 2 +-
>  drivers/char/nwbutton.c   | 2 +-
>  drivers/char/rtc.c| 2 +-
>  drivers/input/touchscreen/s3c2410_ts.c| 2 +-
>  drivers/net/cris/eth_v10.c| 6 +++---
>  drivers/net/hamradio/yam.c| 2 +-
>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>  drivers/staging/speakup/main.c| 2 +-
>  drivers/staging/speakup/synth.c   | 2 +-
>  drivers/tty/cyclades.c| 2 +-
>  drivers/tty/isicom.c  | 2 +-
>  drivers/tty/moxa.c| 2 +-
>  drivers/tty/rocket.c  | 2 +-
>  drivers/tty/vt/keyboard.c | 2 +-
>  drivers/tty/vt/vt.c   | 2 +-
>  drivers/watchdog/alim7101_wdt.c   | 2 +-
>  drivers/watchdog/machzwd.c| 2 +-
>  drivers/watchdog/mixcomwd.c   | 2 +-
>  drivers/watchdog/sbc60xxwdt.c | 2 +-
>  drivers/watchdog/sc520_wdt.c  | 2 +-
>  drivers/watchdog/via_wdt.c| 2 +-
>  drivers/watchdog/w83877f_wdt.c| 2 +-
>  drivers/xen/grant-table.c | 2 +-
>  fs/pstore/platform.c  | 2 +-
>  include/linux/timer.h | 4 ++--
>  kernel/irq/spurious.c | 2 +-
>  lib/random32.c| 2 +-
>  net/atm/mpc.c | 2 +-
>  net/decnet/dn_route.c | 2 +-
>  net/ipv6/ip6_flowlabel.c  | 2 +-
>  net/netrom/nr_loopback.c  | 2 +-
>  security/keys/gc.c| 2 +-
>  sound/oss/midibuf.c   | 2 +-
>  sound/oss/soundcard.c | 2 +-
>  sound/oss/sys_timer.c | 2 +-
>  sound/oss/uart6850.c  | 2 +-
>  47 files changed, 54 insertions(+), 54 deletions(-)

Acked-by: Ralf Baechle 

Thanks,

  Ralf


Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER

2017-10-09 Thread Ralf Baechle
On Wed, Oct 04, 2017 at 04:27:03PM -0700, Kees Cook wrote:

> Subject: [PATCH 09/13] timer: Remove users of expire and data arguments to
>  DEFINE_TIMER
> 
> The expire and data arguments of DEFINE_TIMER are only used in two places
> and are ignored by the code (malta-display.c only uses mod_timer(),
> never add_timer(), so the preset expires value is ignored). Set both
> sets of arguments to zero.
> 
> Cc: Ralf Baechle 
> Cc: Wim Van Sebroeck 
> Cc: Guenter Roeck 
> Cc: Geert Uytterhoeven 
> Cc: linux-m...@linux-mips.org
> Cc: linux-watch...@vger.kernel.org
> Signed-off-by: Kees Cook 
> ---
>  arch/mips/mti-malta/malta-display.c | 6 +++---
>  drivers/watchdog/alim7101_wdt.c | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)

For malta-display:

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH] mm, arch: remove empty_bad_page*

2017-10-05 Thread Ralf Baechle
On Wed, Oct 04, 2017 at 05:00:45PM +0200, Michal Hocko wrote:

> From: Michal Hocko 
> 
> empty_bad_page and empty_bad_pte_table seems to be a relict from old
> days which is not used by any code for a long time. I have tried to find
> when exactly but this is not really all that straightforward due to many
> code movements - traces disappear around 2.4 times.
> 
> Anyway no code really references neither empty_bad_page nor
> empty_bad_pte_table. We only allocate the storage which is not used by
> anybody so remove them.
> 
> Cc: Yoshinori Sato 
> Cc: Ralf Baechle 
> Cc: David Howells 
> Cc: Rich Felker 
> Cc: Jeff Dike 
> Cc: Richard Weinberger 
> Cc: Ingo Molnar 
> Cc: 
> Cc: 
> Cc: 
> Signed-off-by: Michal Hocko 

On MIPS the empty_bad_page_table definition was deleted in 2549fa57708d
("Small cleanups including deletion of two variables 4k each ...") in the
MIPS git tree on 2003-07-29, so

Acked-by: Ralf Baechle 

for getting rid of the rest a mere 14 years later.

Thanks,

  Ralf


Re: [PATCH] MIPS: ath79: support devicetree selection

2017-09-06 Thread Ralf Baechle
On Fri, Aug 18, 2017 at 05:32:42PM +0200, Rocco Folino wrote:

> Allow to choose devicetrees from Kconfig.
> 
> Signed-off-by: Rocco Folino 
> ---
>  arch/mips/ath79/Kconfig | 44 
> +
>  arch/mips/boot/dts/qca/Makefile | 10 +-
>  2 files changed, 49 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
> index dfc60209dc63..b43d116187af 100644
> --- a/arch/mips/ath79/Kconfig
> +++ b/arch/mips/ath79/Kconfig
> @@ -1,5 +1,49 @@
>  if ATH79
>  
> +menu "Atheros AR71XX/AR724X/AR913X devicetree selection"
> +
> +config DTB_ATH_DPT_MODULE
> + bool "DPTechnics DPT-Module"
> + select SOC_933X

There is no symbol SOC_933X.  Did you mean SOC_AR933X?

Anyway, your patch does more than the changelog ("Allow to choose
devicetrees from Kconfig") says, so please either fix the changelog
or split that into multiple patches with proper changelogs.

  Ralf


Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer

2017-09-01 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer

2017-09-01 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH v2 2/7] MIPS: numa: Remove the unused parent_node() macro

2017-09-01 Thread Ralf Baechle
On Fri, Sep 01, 2017 at 10:56:34AM +0800, Dou Liyang wrote:

> Commit a7be6e5a7f8d ("mm: drop useless local parameters of
> __register_one_node()") removes the last user of parent_node().
> 
> The parent_node() macros in both IP27 and Loongson64 are unnecessary.
> 
> Remove it for cleanup.

I already applied v1.

Thanks,

  Ralf


Re: [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer

2017-09-01 Thread Ralf Baechle
On Thu, Aug 31, 2017 at 04:29:35PM -0700, Kees Cook wrote:

> In preparation for changing the timer callback argument to the timer
> pointer, move to a separate static data variable.
> 
> Cc: Ralf Baechle 
> Cc: Ingo Molnar 
> Cc: Arnd Bergmann 
> Cc: linux-m...@linux-mips.org
> Signed-off-by: Kees Cook 
> ---
>  arch/mips/sgi-ip32/ip32-reset.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
> index 4e263fd4deff..6636a9c686cd 100644
> --- a/arch/mips/sgi-ip32/ip32-reset.c
> +++ b/arch/mips/sgi-ip32/ip32-reset.c
> @@ -38,6 +38,7 @@
>  extern struct platform_device ip32_rtc_device;
>  
>  static struct timer_list power_timer, blink_timer;
> +static unsigned long blink_timer_timeout;

Similar to the IP22 patch this patch removes power_timer ...

>  static int has_panicked, shutting_down;
>  
>  static __noreturn void ip32_poweroff(void *data)
> @@ -71,11 +72,11 @@ static void ip32_machine_restart(char *cmd)
>   unreachable();
>  }
>  
> -static void blink_timeout(unsigned long data)
> +static void blink_timeout(unsigned long unused)
>  {
>   unsigned long led = mace->perif.ctrl.misc ^ MACEISA_LED_RED;
>   mace->perif.ctrl.misc = led;
> - mod_timer(&blink_timer, jiffies + data);
> + mod_timer(&blink_timer, jiffies + blink_timer_timeout);
>  }
>  
>  static void ip32_machine_halt(void)
> @@ -99,8 +100,8 @@ void ip32_prepare_poweroff(void)
>   }
>  
>   shutting_down = 1;
> - blink_timer.data = POWERDOWN_FREQ;
> - blink_timeout(POWERDOWN_FREQ);
> + blink_timer_timeout = POWERDOWN_FREQ;
> + blink_timeout(0);
>  
>   setup_timer(&power_timer, power_timeout, 0UL);

... but doesn't fix the users.

>   power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
> @@ -120,8 +121,8 @@ static int panic_event(struct notifier_block *this, 
> unsigned long event,
>   led = mace->perif.ctrl.misc | MACEISA_LED_GREEN;
>   mace->perif.ctrl.misc = led;
>  
> - blink_timer.data = PANIC_FREQ;
> - blink_timeout(PANIC_FREQ);
> + blink_timer_timeout = PANIC_FREQ;
> + blink_timeout(0);
>  
>   return NOTIFY_DONE;
>  }
> @@ -142,8 +143,7 @@ static __init int ip32_reboot_setup(void)
>   _machine_halt = ip32_machine_halt;
>   pm_power_off = ip32_machine_halt;
>  
> - init_timer(&blink_timer);
> - blink_timer.function = blink_timeout;
> + setup_timer(&blink_timer, blink_timeout, 0);
>   atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
>  
>   return 0;

  Ralf


Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer

2017-09-01 Thread Ralf Baechle
On Thu, Aug 31, 2017 at 04:29:36PM -0700, Kees Cook wrote:

> In preparation for changing the timer callback argument to the timer
> pointer, move to a separate static data variable.
> 
> Cc: Ralf Baechle 
> Cc: James Hogan 
> Cc: Ingo Molnar 
> Cc: Paul Gortmaker 
> Cc: linux-m...@linux-mips.org
> Signed-off-by: Kees Cook 
> ---
>  arch/mips/sgi-ip22/ip22-reset.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
> index 196b041866ac..5cc32610e6d3 100644
> --- a/arch/mips/sgi-ip22/ip22-reset.c
> +++ b/arch/mips/sgi-ip22/ip22-reset.c
> @@ -38,6 +38,7 @@
>  #define PANIC_FREQ   (HZ / 8)
>  
>  static struct timer_list power_timer, blink_timer, debounce_timer;
> +static unsigned long blink_timer_timeout;

You're removing power_timer and debounce_timer ...

>  #define MACHINE_PANICED  1
>  #define MACHINE_SHUTTING_DOWN2
> @@ -86,13 +87,13 @@ static void power_timeout(unsigned long data)
>   sgi_machine_power_off();
>  }
>  
> -static void blink_timeout(unsigned long data)
> +static void blink_timeout(unsigned long unused)
>  {
>   /* XXX fix this for fullhouse  */
>   sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
>   sgioc->reset = sgi_ioc_reset;
>  
> - mod_timer(&blink_timer, jiffies + data);
> + mod_timer(&blink_timer, jiffies + blink_timer_timeout);
>  }
>  
>  static void debounce(unsigned long data)
> @@ -128,8 +129,8 @@ static inline void power_button(void)
>   }
>  
>   machine_state |= MACHINE_SHUTTING_DOWN;
> - blink_timer.data = POWERDOWN_FREQ;
> - blink_timeout(POWERDOWN_FREQ);
> + blink_timer_timeout = POWERDOWN_FREQ;
> + blink_timeout(0);
>  
>   setup_timer(&power_timer, power_timeout, 0UL);

... but don't remove the reference to power_timer nor use of debounce_timer.

>   power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
> @@ -169,8 +170,8 @@ static int panic_event(struct notifier_block *this, 
> unsigned long event,
>   return NOTIFY_DONE;
>   machine_state |= MACHINE_PANICED;
>  
> - blink_timer.data = PANIC_FREQ;
> - blink_timeout(PANIC_FREQ);
> + blink_timer_timeout = PANIC_FREQ;
> + blink_timeout(0);
>  
>   return NOTIFY_DONE;
>  }
> @@ -193,8 +194,7 @@ static int __init reboot_setup(void)
>   return res;
>   }
>  
> - init_timer(&blink_timer);
> - blink_timer.function = blink_timeout;
> + setup_timer(&blink_timer, blink_timeout, 0);
>   atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
>  
>   return 0;

  Ralf


Re: [PATCH 3/4] i825xx: switch to switch to dma_alloc_attrs

2017-08-26 Thread Ralf Baechle
On Sat, Aug 26, 2017 at 09:21:24AM +0200, Christoph Hellwig wrote:

Adding Thomas Bogendoerfer , the author of
sni_82596.c to cc.

> This way we can always pass DMA_ATTR_NON_CONSISTENT, the SNI mips version
> will simply ignore the flag.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  drivers/net/ethernet/i825xx/lasi_82596.c | 6 ++
>  drivers/net/ethernet/i825xx/lib82596.c   | 9 +
>  drivers/net/ethernet/i825xx/sni_82596.c  | 6 ++
>  3 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/ethernet/i825xx/lasi_82596.c 
> b/drivers/net/ethernet/i825xx/lasi_82596.c
> index d787fdd5db7b..d5b5021aa759 100644
> --- a/drivers/net/ethernet/i825xx/lasi_82596.c
> +++ b/drivers/net/ethernet/i825xx/lasi_82596.c
> @@ -96,8 +96,6 @@
>  
>  #define OPT_SWAP_PORT0x0001  /* Need to wordswp on the MPU port */
>  
> -#define DMA_ALLOCdma_alloc_noncoherent
> -#define DMA_FREE dma_free_noncoherent
>  #define DMA_WBACK(ndev, addr, len) \
>   do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, 
> DMA_TO_DEVICE); } while (0)
>  
> @@ -200,8 +198,8 @@ static int lan_remove_chip(struct parisc_device *pdev)
>   struct i596_private *lp = netdev_priv(dev);
>  
>   unregister_netdev (dev);
> - DMA_FREE(&pdev->dev, sizeof(struct i596_private),
> -  (void *)lp->dma, lp->dma_addr);
> + dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma,
> +lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
>   free_netdev (dev);
>   return 0;
>  }
> diff --git a/drivers/net/ethernet/i825xx/lib82596.c 
> b/drivers/net/ethernet/i825xx/lib82596.c
> index 8449c58f01fd..f00a1dc2128c 100644
> --- a/drivers/net/ethernet/i825xx/lib82596.c
> +++ b/drivers/net/ethernet/i825xx/lib82596.c
> @@ -1063,8 +1063,9 @@ static int i82596_probe(struct net_device *dev)
>   if (!dev->base_addr || !dev->irq)
>   return -ENODEV;
>  
> - dma = (struct i596_dma *) DMA_ALLOC(dev->dev.parent,
> - sizeof(struct i596_dma), &lp->dma_addr, GFP_KERNEL);
> + dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
> +   &lp->dma_addr, GFP_KERNEL,
> +   DMA_ATTR_NON_CONSISTENT);
>   if (!dma) {
>   printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
>   return -ENOMEM;
> @@ -1085,8 +1086,8 @@ static int i82596_probe(struct net_device *dev)
>  
>   i = register_netdev(dev);
>   if (i) {
> - DMA_FREE(dev->dev.parent, sizeof(struct i596_dma),
> - (void *)dma, lp->dma_addr);
> + dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma),
> +dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
>   return i;
>   }
>  
> diff --git a/drivers/net/ethernet/i825xx/sni_82596.c 
> b/drivers/net/ethernet/i825xx/sni_82596.c
> index 2af7f77345fb..b2c04a789744 100644
> --- a/drivers/net/ethernet/i825xx/sni_82596.c
> +++ b/drivers/net/ethernet/i825xx/sni_82596.c
> @@ -23,8 +23,6 @@
>  
>  static const char sni_82596_string[] = "snirm_82596";
>  
> -#define DMA_ALLOC  dma_alloc_coherent
> -#define DMA_FREE   dma_free_coherent
>  #define DMA_WBACK(priv, addr, len) do { } while (0)
>  #define DMA_INV(priv, addr, len)   do { } while (0)
>  #define DMA_WBACK_INV(priv, addr, len) do { } while (0)
> @@ -152,8 +150,8 @@ static int sni_82596_driver_remove(struct platform_device 
> *pdev)
>   struct i596_private *lp = netdev_priv(dev);
>  
>   unregister_netdev(dev);
> - DMA_FREE(dev->dev.parent, sizeof(struct i596_private),
> -  lp->dma, lp->dma_addr);
> + dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma,
> +lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
>   iounmap(lp->ca);
>   iounmap(lp->mpu_port);
>   free_netdev (dev);
> -- 
> 2.11.0


Re: [PATCH 1/4] sgiseeq: switch to dma_alloc_attrs

2017-08-26 Thread Ralf Baechle
On Sat, Aug 26, 2017 at 09:21:22AM +0200, Christoph Hellwig wrote:

Looks good,

Acked-by: Ralf Baechle 

  Ralf


Re: linux-next: manual merge of the userns tree with the mips tree

2017-08-07 Thread Ralf Baechle
On Tue, Aug 08, 2017 at 03:10:04PM +1000, Stephen Rothwell wrote:

(Maciej added to cc.)

> Hi Eric,
> 
> Today's linux-next merge of the userns tree got a conflict in:
> 
>   arch/mips/kernel/traps.c
> 
> between commit:
> 
>   260a789828aa ("MIPS: signal: Remove unreachable code from 
> force_fcr31_sig().")
> 
> from the mips tree and commit:
> 
>   ea1b75cf9138 ("signal/mips: Document a conflict with SI_USER with SIGFPE")
> 
> from the userns tree.
> 
> I fixed it up (the former removed the code updated by the latter) and
> can carry the fix as necessary. This is now fixed as far as linux-next
> is concerned, but any non trivial conflicts should be mentioned to your
> upstream maintainer when your tree is submitted for merging.  You may
> also want to consider cooperating with the maintainer of the conflicting
> tree to minimise any particularly complex conflicts.

Eric,

after yesterday's emails on the topic I think commit ea1b75cf9138 ("signal/
mips: Document a conflict with SI_USER with SIGFPE") should be dropped.

  Ralf


Re: [PATCH v6] MIPS: NI 169445 board support

2017-08-07 Thread Ralf Baechle
On Mon, Aug 07, 2017 at 10:24:05AM -0700, Paul Burton wrote:

> One possibility would be for us to split the board portions of vmlinux.its.S 
> out into a file per-board, perhaps board-boston.its.S, board-ni169445.its.S 
> etc. The build process would then have to concatenate the right files to 
> generate the full image tree source.
> 
> Does that sound good to you?

Yes, that sounds good.

  Ralf


Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE

2017-08-07 Thread Ralf Baechle
On Mon, Aug 07, 2017 at 10:41:39AM -0700, Linus Torvalds wrote:

> On Mon, Aug 7, 2017 at 9:18 AM, Maciej W. Rozycki  wrote:
> >
> >  So what would be the right value of `si_code' to use here for such an
> > unexpected exception condition?  I think `BUG()' would be too big a
> > hammer here.  Or wouldn't it?
> 
> Hell no. NEVER EVER BUG().
> 
> The only case to use BUG() is if there is some core data structure
> (say, kernel stack) that is so corrupted that you know you cannot
> continue. That's the *only* valid use.
> 
> If this is a "this condition cannot happen" issue, then just remove
> the damn conditional. It's pointless. Adding a BUG() to show "this
> cannot happen" is not acceptable.

I queued a patch to remove the code for 4.14.

  Ralf


Re: [PATCH v6] MIPS: NI 169445 board support

2017-08-07 Thread Ralf Baechle
On Tue, Jul 18, 2017 at 01:29:09PM -0500, Nathan Sullivan wrote:

> Support the National Instruments 169445 board.

Thanks, applied with minor changes:

> --- a/arch/mips/boot/dts/Makefile
> +++ b/arch/mips/boot/dts/Makefile
> @@ -4,6 +4,7 @@ dts-dirs  += img
>  dts-dirs += ingenic
>  dts-dirs += lantiq
>  dts-dirs += mti
> +dts-dirs += ni
>  dts-dirs += netlogic
>  dts-dirs += pic32
>  dts-dirs += qca

Keep things in alphabetical order, so ni should go after netlogic.

> diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
> index f67fbf1..de851f7 100644
> --- a/arch/mips/generic/vmlinux.its.S
> +++ b/arch/mips/generic/vmlinux.its.S
> @@ -29,3 +29,28 @@
>   };
>   };
>  };
> +
> +#ifdef CONFIG_FIT_IMAGE_FDT_NI169445
> +/ {
> + images {
[...]
> + };
> +};
> +#endif

There's been a reject on this file because of a Boston #ifdefed section.
I've fixed that up but we need a cleaner solution.  Paul, any suggestions?

  Ralf


Re: [PATCH v4 05/16] MIPS: math-emu: .: Fix quiet NaN propagation

2017-08-07 Thread Ralf Baechle
On Thu, Jul 27, 2017 at 06:08:48PM +0200, Aleksandar Markovic wrote:

This is a mindbogglingly big series of FP fixes.  There's always a risk
associated with fixes so I'd prefer if they could wait for 4.14.  For now
I'm going to apply them to my 4.14 branch but let me know if you think they
are more urgent than that?

  Ralf


Re: [PATCH 2/2] MIPS: ralink: mt7620: Add missing header

2017-07-18 Thread Ralf Baechle
On Tue, Jul 18, 2017 at 02:25:46PM +0100, Harvey Hunt wrote:

> Fix a build error caused by not including .
> 
> The following compilation errors are caused by the missing header:
> 
> arch/mips/ralink/mt7620.c: In function ‘mt7620_get_cpu_pll_rate’:
> arch/mips/ralink/mt7620.c:431:2: error: implicit declaration of function 
> ‘WARN_ON’ [-Werror=implicit-function-declaration]
>   WARN_ON(div >= ARRAY_SIZE(mt7620_clk_divider));
>   ^
> arch/mips/ralink/mt7620.c: In function ‘mt7620_get_sys_rate’:
> arch/mips/ralink/mt7620.c:500:2: error: implicit declaration of function 
> ‘WARN’ [-Werror=implicit-function-declaration]
>   if (WARN(!div, "invalid divider for OCP ratio %u", ocp_ratio))
>   ^
> arch/mips/ralink/mt7620.c: In function ‘mt7620_dram_init’:
> arch/mips/ralink/mt7620.c:619:3: error: implicit declaration of function 
> ‘BUG’ [-Werror=implicit-function-declaration]
>BUG();
>^
> cc1: some warnings being treated as errors
> scripts/Makefile.build:302: recipe for target 'arch/mips/ralink/mt7620.o' 
> failed
> 
> Signed-off-by: Harvey Hunt 
> Cc: John Crispin 
> Cc: linux-m...@linux-mips.org
> Cc: linux-kernel@vger.kernel.org

Same comment as for the previous patch - looks sensible, so applied.  But
I'm wondering why I don't see this in test builds.

  Ralf


Re: [PATCH 1/2] MIPS: ralink: Fix build error due to missing header

2017-07-18 Thread Ralf Baechle
On Tue, Jul 18, 2017 at 02:25:45PM +0100, Harvey Hunt wrote:

> Previously,  was included before ralink_regs.h in all
> ralink files - leading to  being implicitly included.
> 
> After commit 26dd3e4ff9ac ("MIPS: Audit and remove any unnecessary
> uses of module.h") removed the inclusion of module.h from multiple
> places, some ralink platforms failed to build with the following error:
> 
> In file included from arch/mips/ralink/mt7620.c:17:0:
> ./arch/mips/include/asm/mach-ralink/ralink_regs.h: In function ‘rt_sysc_w32’:
> ./arch/mips/include/asm/mach-ralink/ralink_regs.h:38:2: error: implicit 
> declaration of function ‘__raw_writel’ [-Werror=implicit-function-declaration]
>   __raw_writel(val, rt_sysc_membase + reg);
>   ^
> ./arch/mips/include/asm/mach-ralink/ralink_regs.h: In function ‘rt_sysc_r32’:
> ./arch/mips/include/asm/mach-ralink/ralink_regs.h:43:2: error: implicit 
> declaration of function ‘__raw_readl’ [-Werror=implicit-function-declaration]
>   return __raw_readl(rt_sysc_membase + reg);
> 
> Fix this by including .

Looks sensible, applied.  But I'm wondering why I don't see this in my
test builds.

  Ralf


Re: [PATCH v3 01/18] clk: ingenic: Use const pointer to clk_ops in struct

2017-07-13 Thread Ralf Baechle
On Thu, Jul 13, 2017 at 12:07:25PM +0200, Paul Cercueil wrote:

> > Sorry I forgot, did you want an ack for these clk patches or for
> > me to take them through clk tree. If it's the ack case,
> > 
> > Acked-by: Stephen Boyd 
> > 
> > for patches 1 through 6.
> 
> I think ACK; then Ralf can take them in 4.13 :)

My pull request for 4.13 is already finalized so it'd be great if this
could make it to 4.13 through the clk tree.  If that should be impossible
I'd like to merge this via the MIPS tree for 4.14.

Thanks,

  Ralf


Re: [PATCH v5 05/14] MIPS: ingenic: Enable pinctrl for all ingenic SoCs

2017-07-03 Thread Ralf Baechle
On Mon, Jul 03, 2017 at 11:07:09AM +0200, Linus Walleij wrote:

> > There has been no word from Ralf, is this going into 4.13?

Acked-by: Ralf Baechle 

for the whole series.

Thanks,

  Ralf


Re: [RESEND PATCH] MIPS: head: Reorder instructions missing a delay slot

2017-06-27 Thread Ralf Baechle
On Tue, Jun 27, 2017 at 07:22:16PM +, Karl Beldan wrote:

> In this sequence the 'move' is assumed in the delay slot of the 'beq',
> but head.S is in reorder mode and the former gets pushed one 'nop'
> farther by the assembler.
> 
> The corrected behavior made booting with an UHI supplied dtb erratic.

Excellent catch, patch applied!

Thanks Karl,

  Ralf


Re: [PATCH] pci: Add and use PCI_GENERIC_SETUP Kconfig entry

2017-06-27 Thread Ralf Baechle
On Mon, Jun 26, 2017 at 01:27:56PM -0700, Palmer Dabbelt wrote:

Acked-by: Ralf Baechle 

Thanks,

  Ralf


Re: [PATCH 1/6] MIPS: do not use __GFP_REPEAT for order-0 request

2017-06-23 Thread Ralf Baechle
Feel free to funnel this upstream with the rest of your series.

Acked-by: Ralf Baechle 

Thanks,

  Ralf


Re: [PATCH V5 6/9] MIPS: Loongson-3: support irq_set_affinity() in i8259 chip

2017-06-15 Thread Ralf Baechle
On Thu, Jun 15, 2017 at 10:31:05AM +0800, Huacai Chen wrote:

> With this patch we can set irq affinity via procfs, so as to improve
> network performance.
>
> Signed-off-by: Huacai Chen 
> ---
>  arch/mips/include/asm/irq.h   |  3 ++
>  arch/mips/loongson64/loongson-3/irq.c | 62 
> +++
>  drivers/irqchip/irq-i8259.c   |  3 ++
>  3 files changed, 55 insertions(+), 13 deletions(-)

You didn't cc the IRQCHIP maintainers:

IRQCHIP DRIVERS
M:  Thomas Gleixner 
M:  Jason Cooper 
M:  Marc Zyngier 
L:  linux-kernel@vger.kernel.org
S:  Maintained
T:  git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
T:  git git://git.infradead.org/users/jcooper/linux.git irqchip/core
F:  Documentation/devicetree/bindings/interrupt-controller/
F:  drivers/irqchip/

  Ralf


> diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
> index ddd1c91..47ff7c6 100644
> --- a/arch/mips/include/asm/irq.h
> +++ b/arch/mips/include/asm/irq.h
> @@ -53,6 +53,7 @@ static inline int irq_canonicalize(int irq)
>  #define irq_canonicalize(irq) (irq)  /* Sane hardware, sane code ... */
>  #endif
>  
> +struct irq_data;
>  asmlinkage void plat_irq_dispatch(void);
>  
>  extern void do_IRQ(unsigned int irq);
> @@ -63,6 +64,8 @@ extern void spurious_interrupt(void);
>  extern int allocate_irqno(void);
>  extern void alloc_legacy_irqno(void);
>  extern void free_irqno(unsigned int irq);
> +extern int plat_set_irq_affinity(struct irq_data *d,
> +  const struct cpumask *affinity, bool force);
>  
>  /*
>   * Before R2 the timer and performance counter interrupts were both fixed to
> diff --git a/arch/mips/loongson64/loongson-3/irq.c 
> b/arch/mips/loongson64/loongson-3/irq.c
> index 2e6e205..e8b7a47 100644
> --- a/arch/mips/loongson64/loongson-3/irq.c
> +++ b/arch/mips/loongson64/loongson-3/irq.c
> @@ -10,32 +10,68 @@
>  #include "smp.h"
>  
>  extern void loongson3_send_irq_by_ipi(int cpu, int irqs);
> +
> +unsigned int irq_cpu[16] = {[0 ... 15] = -1};
>  unsigned int ht_irq[] = {0, 1, 3, 4, 5, 6, 7, 8, 12, 14, 15};
>  unsigned int local_irq = 1<<0 | 1<<1 | 1<<2 | 1<<7 | 1<<8 | 1<<12;
>  
> +int plat_set_irq_affinity(struct irq_data *d, const struct cpumask *affinity,
> +   bool force)
> +{
> + unsigned int cpu;
> + struct cpumask new_affinity;
> +
> + /* I/O devices are connected on package-0 */
> + cpumask_copy(&new_affinity, affinity);
> + for_each_cpu(cpu, affinity)
> + if (cpu_data[cpu].package > 0)
> + cpumask_clear_cpu(cpu, &new_affinity);
> +
> + if (cpumask_empty(&new_affinity))
> + return -EINVAL;
> +
> + cpumask_copy(d->common->affinity, &new_affinity);
> +
> + return IRQ_SET_MASK_OK_NOCOPY;
> +}
> +
>  static void ht_irqdispatch(void)
>  {
> - unsigned int i, irq, irq0, irq1;
> - static unsigned int dest_cpu = 0;
> + unsigned int i, irq;
> + struct irq_data *irqd;
> + struct cpumask affinity;
>  
>   irq = LOONGSON_HT1_INT_VECTOR(0);
>   LOONGSON_HT1_INT_VECTOR(0) = irq; /* Acknowledge the IRQs */
>  
> - irq0 = irq & local_irq;  /* handled by local core */
> - irq1 = irq & ~local_irq; /* balanced by other cores */
> + for (i = 0; i < ARRAY_SIZE(ht_irq); i++) {
> + if (!(irq & (0x1 << ht_irq[i])))
> + continue;
>  
> - if (dest_cpu == 0 || !cpu_online(dest_cpu))
> - irq0 |= irq1;
> - else
> - loongson3_send_irq_by_ipi(dest_cpu, irq1);
> + /* handled by local core */
> + if (local_irq & (0x1 << ht_irq[i])) {
> + do_IRQ(ht_irq[i]);
> + continue;
> + }
>  
> - dest_cpu = dest_cpu + 1;
> - if (dest_cpu >= num_possible_cpus() || cpu_data[dest_cpu].package > 0)
> - dest_cpu = 0;
> + irqd = irq_get_irq_data(ht_irq[i]);
> + cpumask_and(&affinity, irqd->common->affinity, cpu_active_mask);
> + if (cpumask_empty(&affinity)) {
> + do_IRQ(ht_irq[i]);
> + continue;
> + }
>  
> - for (i = 0; i < ARRAY_SIZE(ht_irq); i++) {
> - if (irq0 & (0x1 << ht_irq[i]))
> + irq_cpu[ht_irq[i]] = cpumask_next(irq_cpu[ht_irq[i]], 
> &affinity);
> + if (irq_cpu[ht_irq[i]] >= nr_cpu_ids)
> + irq_cpu[ht_irq[i]] = cpumask_first(&affinity);
> +
> + if (irq_cpu[ht_irq[i]] == 0) {
>   do_IRQ(ht_irq[i]);
> + continue;
> + }
> +
> + /* balanced by other cores */
> + loongson3_send_irq_by_ipi(irq_cpu[ht_irq[i]], (0x1 << 
> ht_irq[i]));
>   }
>  }
>  
> diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c
> index 1aec12c..95d21e3 100644
> --- a/drivers/irqchip/irq-i8259.c
> +++ b/drivers/irqchip

Re: [PATCH v6 3/4] remoteproc/MIPS: Add a remoteproc driver for MIPS

2017-06-14 Thread Ralf Baechle
ping again ...

  Ralf

On Mon, Apr 03, 2017 at 11:11:04AM +0100, Matt Redfearn wrote:

> Hi Bjorn,
> 
> Please could you provide any comments / review on this driver?
> 
> Thanks,
> 
> Matt
> 
> 
> On 23/03/17 16:37, Matt Redfearn wrote:
> > This driver allows a MIPS processor offlined from Linux to be used as a
> > remote processor. The processor can then handle real-time tasks or
> > perform coprocessing while remaining processors are available to Linux,
> > effectively making the system hybrid of SMP Linux and AMP.
> > 
> > A sysfs interface is provided to allow control of which system CPUs may
> > be acquired by the driver when offlined from Linux.
> > 
> > Coprocessor firmware must abide by the remoteproc standard, i.e.
> > implement the resource table containing memory layouts and virtio device
> > descriptions, and additionally abide by the MIPS UHI coprocessor boot
> > protocol in the startup code.
> > 
> > Example firmware and host executables to test them are located at [1].
> > 
> > [1] https://github.com/MIPS/mips-rproc-example
> > 
> > Signed-off-by: Lisa Parratt 
> > Signed-off-by: Matt Redfearn 
> > 
> > ---
> > 
> > Changes in v6:
> > Change to set_current_state() as set_task_state has been removed.
> > 
> > Changes in v5:
> > Depend on !64bit since this driver only works with 32bit kernels
> > Set mproc->tsk state to TASK_DEAD before freeing it to avoid warning
> > Flush icache of each carveout so that icache sees latest data written
> > 
> > Changes in v4:
> > Have a single mips-rproc device to be parent to each CPU's rproc device.
> > Support per-device coherence introduced in v4.9
> > Add a sysfs interface to control the mask of cpus available to rproc
> > 
> > Changes in v3:
> > Update MIPS remoteproc driver to use CPU hotplug state machine
> > Remove sysfs interface from MIPS rproc driver, now provided by the core.
> > Drop patches that Ralf has already merged to mips-next
> > 
> > Changes in v2: None
> > 
> >   Documentation/ABI/testing/sysfs-devices-mips-rproc |  13 +
> >   drivers/remoteproc/Kconfig |  11 +
> >   drivers/remoteproc/Makefile|   1 +
> >   drivers/remoteproc/mips_remoteproc.c   | 599 
> > +
> >   4 files changed, 624 insertions(+)
> >   create mode 100644 Documentation/ABI/testing/sysfs-devices-mips-rproc
> >   create mode 100644 drivers/remoteproc/mips_remoteproc.c
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-devices-mips-rproc 
> > b/Documentation/ABI/testing/sysfs-devices-mips-rproc
> > new file mode 100644
> > index ..b06f6671807a
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-devices-mips-rproc
> > @@ -0,0 +1,13 @@
> > +What:  /sys/devices/mips-rproc/cpus
> > +Date:  October 2016
> > +Contact:   Matt Redfearn 
> > +Description:
> > +   CPU topology file describing which CPUs may be used by the
> > +   MIPS remote processor driver when offline from Linux.
> > +
> > +   This can be read to observe the current setting, or written to
> > +   change the allowed CPUs.
> > +
> > +   The format is compatible with cpulist_parse()
> > +   [see ], for example to enable the MIPS remote
> > +   processor driver on CPUs 1,2 & 3, write "1-3" into this file.
> > diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> > index 65f86bc24c07..558b67184723 100644
> > --- a/drivers/remoteproc/Kconfig
> > +++ b/drivers/remoteproc/Kconfig
> > @@ -71,6 +71,17 @@ config DA8XX_REMOTEPROC
> >   It's safe to say n here if you're not interested in multimedia
> >   offloading.
> > +config MIPS_REMOTEPROC
> > +   tristate "MIPS remoteproc support"
> > +   depends on MIPS_CPS && HAS_DMA && !64BIT
> > +   depends on REMOTEPROC
> > +   select CMA
> > +   select MIPS_CPU_STEAL
> > +   help
> > + Say y here to support using offline cores/VPEs as remote processors
> > + via the remote processor framework.
> > + If unsure say N.
> > +
> >   config QCOM_ADSP_PIL
> > tristate "Qualcomm ADSP Peripheral Image Loader"
> > depends on OF && ARCH_QCOM
> > diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> > index ffc5e430df27..9525debba686 100644
> > --- a/drivers/remoteproc/Makefile
> > +++ b/drivers/remoteproc/Makefile
> > @@ -11,6 +11,7 @@ remoteproc-y  += 
> > remoteproc_elf_loader.o
> >   obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o
> >   obj-$(CONFIG_WKUP_M3_RPROC)   += wkup_m3_rproc.o
> >   obj-$(CONFIG_DA8XX_REMOTEPROC)+= da8xx_remoteproc.o
> > +obj-$(CONFIG_MIPS_REMOTEPROC)  += mips_remoteproc.o
> >   obj-$(CONFIG_QCOM_ADSP_PIL)   += qcom_adsp_pil.o
> >   obj-$(CONFIG_QCOM_RPROC_COMMON)   += qcom_common.o
> >   obj-$(CONFIG_QCOM_Q6V5_PIL)   += qcom_q6v5_pil.o
> > diff --git a/drivers/remoteproc/mips_remoteproc.c 
> > b/drivers/remote

Re: [PATCH v2 0/5] MIPS: Implement eBPF JIT.

2017-06-14 Thread Ralf Baechle
On Tue, Jun 13, 2017 at 03:28:42PM -0700, David Daney wrote:

> Changes in v2:
> 
>   - Squash a couple of the uasm cleanups.
> 
>   - Make insn_table_MM const (suggested by Matt Redfearn)
> 
>   - Put the eBPF in its own source file (should fix build
> warnings/errors on 32-bit kernel builds).
> 
>   - Use bpf_jit_binary_alloc() (suggested by Daniel Borkmann)
> 
>   - Implement tail calls.
> 
>   - Fix system call tracing to extract arguments for
> kprobe/__seccomp_filter() tracing (perhaps not really part the the
> JIT, but necessary to have fun with the samples/bpf programs).
> 
> Most things in samples/bpf work, still working on the incantations to
> build tools/testing/selftests/bpf/ ... 
> 
> 
> >From v1:
> 
> The first three patches improve MIPS uasm in preparation for use by
> the JIT.  Then the eBPF JIT implementation.
> 
> I am CCing netdev@ and the BPF maintainers for their comments, but
> would expect Ralf to merge via the MIPS tree if and when it all looks
> good.

Thanks, applied after fixing a minor conflict in arch/mips/Kconfig.

  Ralf


Re: [PATCH 7/7] MIPS: Use generic libgcc intrinsics

2017-06-09 Thread Ralf Baechle
On Tue, Jun 06, 2017 at 12:10:23PM -0700, Palmer Dabbelt wrote:

> These routines in arch/mips/lib/ are functionally identical to those
> recently added to lib/ so remove them and select the generic ones.
> 
> Signed-off-by: Matt Redfearn 
> Signed-off-by: Palmer Dabbelt 

Thanks, nice cleanup!

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH 0/4] MMC support for Octeon platforms.

2017-04-25 Thread Ralf Baechle
On Mon, Apr 24, 2017 at 09:56:42PM +0200, Ulf Hansson wrote:

> Thanks, applied patch 1->3. Patch 4 is for the MIPS SoC maintainer,
> unless I get an ack for it.

Here's the Ack for patch 4:

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH] MAINTAINERS: Update email-id of Rahul Bedarkar

2017-04-18 Thread Ralf Baechle
On Tue, Apr 18, 2017 at 02:04:36PM +0530, Rahul Bedarkar wrote:

> I'm no longer with Imagination Technologies. I am still interested in
> maintaining or reviewing DTS patches for Ci40 if any. Update email-id
> to an active one.
> 
> Signed-off-by: Rahul Bedarkar 
> ---
> I'm not sure via which tree this should get in. Since this entry was
> merged via MIPS tree, I'm sending to linux-mips mailing list.

I will take care of your patch.

Thanks for keeping your entry up to date and meaningful!

  Ralf


Re: [PATCH] MIPS: clockevent drivers: set ->min_delta_ticks and ->max_delta_ticks

2017-04-12 Thread Ralf Baechle
On Thu, Mar 30, 2017 at 09:47:32PM +0200, Nicolai Stange wrote:

> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
> 
> Make the MIPS arch's clockevent drivers initialize these fields properly.
> 
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from these
> drivers.
> 
> Signed-off-by: Nicolai Stange 

Acked-by: Ralf Baechle 

Feel free to push this to Linus.

  Ralf


Re: [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core

2017-04-12 Thread Ralf Baechle
Thanks, applied.

  Ralf


Re: [PATCH] MIPS: generic: Enable Root FS on NFS in generic_defconfig

2017-04-12 Thread Ralf Baechle

Thanks, applied.

  Ralf


Re: [PATCH] MIPS: Remove dead define of ST_OFF

2017-04-10 Thread Ralf Baechle
Thanks, applied.

  Ralf


Re: [PATCH] MIPS: perf: fix deadlock

2017-04-10 Thread Ralf Baechle
Thanks, applied.

  Ralf


Re: [PATCH v2] MIPS: Malta: Fix i8259 irqchip setup

2017-04-10 Thread Ralf Baechle
On Thu, Apr 06, 2017 at 04:58:09PM +0100, Matt Redfearn wrote:

Thanks, applied.

  Ralf


Re: [PATCH] MIPS: IRQ Stack: Unwind IRQ stack onto task stack

2017-04-04 Thread Ralf Baechle
On Tue, Apr 04, 2017 at 01:58:04PM +0200, Jason A. Donenfeld wrote:

> This indeed is useful. Out of curiosity, are other archs using a
> similar technique? In anycase,
> 
> Acked-by: Jason A. Donenfeld 

Unfortunately MIPS doesn't have anything like a frame pointer or similar
to make backtracing easy so proper stacktraces have always been more of
rocket science than they really ought to ...

  Ralf


Re: [PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup

2017-03-31 Thread Ralf Baechle
On Fri, Mar 31, 2017 at 12:05:31PM +0100, Matt Redfearn wrote:

> diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
> index cb675ec6f283..474b372e0dd9 100644
> --- a/arch/mips/mti-malta/malta-int.c
> +++ b/arch/mips/mti-malta/malta-int.c
> @@ -232,6 +232,19 @@ void __init arch_init_irq(void)
>  {
>   int corehi_irq;
>  
> +#ifdef CONFIG_I8259
> + /*
> +  * Preallocate the i8259's expected virq's here. Since irqchip_init()
> +  * will probe the irqchips in hierarchial order, i8259 is probed last.
> +  * If anything allocates a virq before the i8259 is probed, it will
> +  * be given one of the i8259's expected range and consequently setup
> +  * of the i8259 will fail.
> +  */
> + WARN(irq_alloc_descs(I8259A_IRQ_BASE, I8259A_IRQ_BASE,
> + 16, numa_node_id()) < 0,
> + "Cannot reserve i8259 virqs at IRQ%d\n", I8259A_IRQ_BASE);
> +#endif /* CONFIG_I8259 */
> +
>   i8259_set_poll(mips_pcibios_iack);

CONFIG_I8259 is always defined on Malta so the #ifdef is pointless.

  Ralf


Re: [PATCH 2/2] irqchip/mips-gic: Fix Local compare interrupt

2017-03-31 Thread Ralf Baechle
On Fri, Mar 31, 2017 at 12:05:32PM +0100, Matt Redfearn wrote:

> Commit 4cfffcfa5106 ("irqchip/mips-gic: Fix local interrupts") added
> mapping of several local interrupts during initialisation of the gic
> driver. This associates virq numbers with these interrupts.
> Unfortunately, as not all of the interrupts are mapped in hardware
> order, when drivers subsequently request these interrupts they conflict
> with the mappings that have already been set up. For example, this
> manifests itself in the gic clocksource driver, which fails to probe
> with the message:
> 
> clocksource: GIC: mask: 0x max_cycles: 0x7350c9738,
> max_idle_ns: 440795203769 ns
> GIC timer IRQ 25 setup failed: -22
> 
> This is because virq 25 (the correct IRQ number specified via device
> tree) was allocated to the PERFCTR interrupt (and 24 to the timer, 26 to
> the FDC). To fix this, map all of these local interrupts in the hardware
> order so as to associate their virq numbers with the correct hw
> interrupts.
> 
> Fixes: 4cfffcfa5106 ("irqchip/mips-gic: Fix local interrupts")
> Signed-off-by: Matt Redfearn 

Acked-by: Ralf Baechle 

  Ralf


Re: next build: 208 builds: 9 failed, 199 passed, 857 errors, 444 warnings (next-20170323)

2017-03-24 Thread Ralf Baechle
On Thu, Mar 23, 2017 at 07:44:50PM +0100, Ralf Baechle wrote:

> > On Thu, Mar 23, 2017 at 6:46 AM, kernelci.org bot  wrote:
> > 
> > > acs5k_defconfig (arm) — PASS, 0 errors, 2 warnings, 0 section mismatches
> > >
> > > Warnings:
> > > :1328:2: warning: #warning syscall arch_prctl not implemented [-Wcpp]
> > > :1328:2: warning: #warning syscall arch_prctl not implemented [-Wcpp]
> > 
> > patch sent today, we don't really want this syscall except on x86
> > 
> > > allmodconfig (arm64) — FAIL, 6 errors, 5 warnings, 0 section mismatches
> > >
> > > Errors:
> > > ERROR (phandle_references): Reference to non-existent node or label 
> > > "pwm_f_clk_pins"
> > > ERROR (phandle_references): Reference to non-existent node or label 
> > > "pwm_ao_a_3_pins"
> > > ERROR: Input tree has errors, aborting (use -f to force output)
> > > ERROR (phandle_references): Reference to non-existent node or label 
> > > "pwm_f_clk_pins"
> > > ERROR (phandle_references): Reference to non-existent node or label 
> > > "pwm_ao_a_3_pins"
> > > ERROR: Input tree has errors, aborting (use -f to force output)
> > 
> > Kevin has already backed out the commit that caused this.
> > 
> > > Warnings:
> > > :1325:2: warning: #warning syscall statx not implemented [-Wcpp]
> > 
> > Should get fixed in the next few days when the patch gets picked up for 
> > arm64.
> > 
> > > drivers/misc/aspeed-lpc-ctrl.c:232:17: warning: format '%x' expects 
> > > argument of type 'unsigned int', but argument 4 has type 'resource_size_t 
> > > {aka long long unsigned int}' [-Wformat=]
> > 
> > patch sent today
> > 
> > > include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer 
> > > implicitly truncated to unsigned type [-Woverflow]
> > > include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer 
> > > implicitly truncated to unsigned type [-Woverflow]
> > 
> > I sent this one a few days ago
> > 
> > > allmodconfig (x86) — PASS, 0 errors, 11 warnings, 0 section mismatches
> > >
> > > Warnings:
> > > drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' 
> > > expects argument of type 'long int', but argument 4 has type 'long long 
> > > int' [-Wformat=]
> > > drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' 
> > > expects argument of type 'long int', but argument 5 has type 'long long 
> > > int' [-Wformat=]
> > 
> > This one too.
> > 
> > > cavium_octeon_defconfig (mips) — FAIL, 830 errors, 3 warnings, 0 section 
> > > mismatches
> > >
> > > Errors:
> > > arch/mips/include/asm/octeon/cvmx-mio-defs.h:78:3: error: expected 
> > > specifier-qualifier-list before '__BITFIELD_FIELD'
> > > arch/mips/include/asm/octeon/cvmx-mio-defs.h:95:3: error: expected 
> > > specifier-qualifier-list before '__BITFIELD_FIELD'
> > 
> > Maybe caused by 4cd156de2ca8 ("MIPS: Octeon: Remove unused MIO types
> > and macros.")
> > I have not looked in detail
> 
> Seems an #include  is missing.  I'm going to sort
> this one.

I fixed this in my branch for linux-next only to encounter another build
error so I dropped another two patches.

  Ralf


Re: next build: 208 builds: 9 failed, 199 passed, 857 errors, 444 warnings (next-20170323)

2017-03-23 Thread Ralf Baechle
On Thu, Mar 23, 2017 at 05:19:14PM +0100, Arnd Bergmann wrote:
> Date:   Thu, 23 Mar 2017 17:19:14 +0100
> From: Arnd Bergmann 
> To: "kernelci.org bot" 
> Cc: kernel-build-repo...@lists.linaro.org, Linux Kernel Mailing List
>  , linux-cry...@vger.kernel.org,
>  linux-m...@linux-mips.org, "Steven J. Hill" , Ralf
>  Baechle 
> Subject: Re: next build: 208 builds: 9 failed, 199 passed, 857 errors, 444
>  warnings (next-20170323)
> Content-Type: text/plain; charset=UTF-8
> 
> On Thu, Mar 23, 2017 at 6:46 AM, kernelci.org bot  wrote:
> 
> > acs5k_defconfig (arm) — PASS, 0 errors, 2 warnings, 0 section mismatches
> >
> > Warnings:
> > :1328:2: warning: #warning syscall arch_prctl not implemented [-Wcpp]
> > :1328:2: warning: #warning syscall arch_prctl not implemented [-Wcpp]
> 
> patch sent today, we don't really want this syscall except on x86
> 
> > allmodconfig (arm64) — FAIL, 6 errors, 5 warnings, 0 section mismatches
> >
> > Errors:
> > ERROR (phandle_references): Reference to non-existent node or label 
> > "pwm_f_clk_pins"
> > ERROR (phandle_references): Reference to non-existent node or label 
> > "pwm_ao_a_3_pins"
> > ERROR: Input tree has errors, aborting (use -f to force output)
> > ERROR (phandle_references): Reference to non-existent node or label 
> > "pwm_f_clk_pins"
> > ERROR (phandle_references): Reference to non-existent node or label 
> > "pwm_ao_a_3_pins"
> > ERROR: Input tree has errors, aborting (use -f to force output)
> 
> Kevin has already backed out the commit that caused this.
> 
> > Warnings:
> > :1325:2: warning: #warning syscall statx not implemented [-Wcpp]
> 
> Should get fixed in the next few days when the patch gets picked up for arm64.
> 
> > drivers/misc/aspeed-lpc-ctrl.c:232:17: warning: format '%x' expects 
> > argument of type 'unsigned int', but argument 4 has type 'resource_size_t 
> > {aka long long unsigned int}' [-Wformat=]
> 
> patch sent today
> 
> > include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer 
> > implicitly truncated to unsigned type [-Woverflow]
> > include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer 
> > implicitly truncated to unsigned type [-Woverflow]
> 
> I sent this one a few days ago
> 
> > allmodconfig (x86) — PASS, 0 errors, 11 warnings, 0 section mismatches
> >
> > Warnings:
> > drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects 
> > argument of type 'long int', but argument 4 has type 'long long int' 
> > [-Wformat=]
> > drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects 
> > argument of type 'long int', but argument 5 has type 'long long int' 
> > [-Wformat=]
> 
> This one too.
> 
> > cavium_octeon_defconfig (mips) — FAIL, 830 errors, 3 warnings, 0 section 
> > mismatches
> >
> > Errors:
> > arch/mips/include/asm/octeon/cvmx-mio-defs.h:78:3: error: expected 
> > specifier-qualifier-list before '__BITFIELD_FIELD'
> > arch/mips/include/asm/octeon/cvmx-mio-defs.h:95:3: error: expected 
> > specifier-qualifier-list before '__BITFIELD_FIELD'
> 
> Maybe caused by 4cd156de2ca8 ("MIPS: Octeon: Remove unused MIO types
> and macros.")
> I have not looked in detail

Seems an #include  is missing.  I'm going to sort
this one.

Thanks,

  Ralf


Re: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-22 Thread Ralf Baechle
On Wed, Mar 22, 2017 at 05:38:09AM +, Amit Kama IL wrote:

> Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
> The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
> using device-tree.
> 
> Signed-off-by: Amit Kama 
> 
> The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
> IRQCHIP maintainers - is it possible to merge this through MIPS tree? 


First thig, run your patch through scripts/checkpatch.pl and fix the
resulting pile of errors and warnings.

sx3000_machine_halt() will consume plenty of power if implemented as a
empty loop:

+static void sx3000_machine_halt(void)
+{
+   while (true);
+}

Something like:

static void sx3000_machine_halt(void)
{
local_irq_disable();
while (1) {
if (cpu_wait)
cpu_wait();
}
}

will make the function much "greener".

  Ralf


Re: [PATCH] MIPS: smp-cps: Fix retrieval of VPE mask on big endian CPUs

2017-03-21 Thread Ralf Baechle
On Tue, Mar 21, 2017 at 02:39:19PM +, Matt Redfearn wrote:

Thanks, applied.

  Ralf


Re: [PATCH 4.4 04/35] MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change

2017-03-20 Thread Ralf Baechle
On Mon, Mar 20, 2017 at 05:29:30PM +0100, Greg Kroah-Hartman wrote:

> You reported it there, but then on your other emails for other stable
> trees, said that your previously mentioned patches fixed problems in
> these trees as well.  A bit confusing, sorry I got it wrong.
> 
> Anyway, not a big deal, is this worth me reverting?  Does this cause an
> issue with these arches on older kernels?

Can't imagine this is going to cause an issue and in case of doubt a "y"
should be safer than a "m" anyway ...

  Ralf


Re: [PATCH 4.4 08/35] MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change

2017-03-20 Thread Ralf Baechle
On Mon, Mar 20, 2017 at 05:29:57PM +0100, Greg Kroah-Hartman wrote:

> > I don't think so, I don't get warnings for "make ARCH=mips 
> > lemote2f_defconfig"
> 
> Ok, is it worth reverting as this is an issue on later kernels?

Same answer as for the other patch - I can't imagine it's going to cause
any problems.

  Ralf


Re: [PATCH 4.4 08/35] MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change

2017-03-20 Thread Ralf Baechle
On Sun, Mar 19, 2017 at 04:06:19PM +, Ben Hutchings wrote:

> On Thu, 2017-03-16 at 23:29 +0900, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Arnd Bergmann 
> > 
> > commit b3f6046186ef45acfeebc5a59c9fb45cefc685e7 upstream.
> > 
> > Since linux-4.8, CPU_FREQ_STAT is a bool symbol, causing a warning in
> > kernelci.org:
> > 
> > arch/mips/configs/lemote2f_defconfig:42:warning: symbol value 'm' invalid 
> > for CPU_FREQ_STAT
> > 
> > This updates the defconfig to have the feature built-in.
> > 
> > Fixes: 1aefc75b2449 ("cpufreq: stats: Make the stats code non-modular")
> [...]
> 
> So not needed for 4.4?

I don't think so, I don't get warnings for "make ARCH=mips lemote2f_defconfig"

  Ralf


Re: [PATCH 4.4 04/35] MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change

2017-03-20 Thread Ralf Baechle
On Sun, Mar 19, 2017 at 04:05:16PM +, Ben Hutchings wrote:
> Date:   Sun, 19 Mar 2017 16:05:16 +
> From: Ben Hutchings 
> To: Greg Kroah-Hartman ,
>  linux-kernel@vger.kernel.org
> Cc: sta...@vger.kernel.org, Arnd Bergmann ,
>  linux-m...@linux-mips.org, Ralf Baechle 
> Subject: Re: [PATCH 4.4 04/35] MIPS: Update defconfigs for
>  NF_CT_PROTO_DCCP/UDPLITE change
> Content-Type: multipart/signed; micalg="pgp-sha512";
> protocol="application/pgp-signature";
>  boundary="=-AwAI9QrjXVRk/IPasf40"
> 
> On Thu, 2017-03-16 at 23:29 +0900, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Arnd Bergmann 
> > 
> > commit 9ddc16ad8e0bc7742fc96d5aaabc5b8698512cd1 upstream.
> > 
> > In linux-4.10-rc, NF_CT_PROTO_UDPLITE and NF_CT_PROTO_DCCP are bool
> > symbols instead of tristate, and kernelci.org reports a bunch of
> > warnings for this, like:
> > 
> > arch/mips/configs/malta_kvm_guest_defconfig:63:warning: symbol value 'm' 
> > invalid for NF_CT_PROTO_UDPLITE
> > arch/mips/configs/malta_defconfig:62:warning: symbol value 'm' invalid for 
> > NF_CT_PROTO_DCCP
> > arch/mips/configs/malta_defconfig:63:warning: symbol value 'm' invalid for 
> > NF_CT_PROTO_UDPLITE
> > arch/mips/configs/ip22_defconfig:70:warning: symbol value 'm' invalid for 
> > NF_CT_PROTO_DCCP
> > arch/mips/configs/ip22_defconfig:71:warning: symbol value 'm' invalid for 
> > NF_CT_PROTO_UDPLITE
> > 
> > This changes all the MIPS defconfigs with these symbols to have them
> > built-in.
> > 
> > Fixes: 9b91c96c5d1f ("netfilter: conntrack: built-in support for UDPlite")
> > Fixes: c51d39010a1b ("netfilter: conntrack: built-in support for DCCP")
> [...]
> 
> I don't think this was needed for 4.4 or 4.9, as those symbols were
> still tristate type.

Indeed, there's no waring for "make ARCH=mips malta_kvm_guest_defconfig".

  Ralf


Re: [PATCH] MIPS: Add 48-bit VA space (and 4-level page tables) for 4K pages.

2017-03-15 Thread Ralf Baechle
On Thu, Feb 16, 2017 at 05:27:34PM -0800, David Daney wrote:

> From: Alex Belits 
> 
> Some users must have 4K pages while needing a 48-bit VA space size.
> The cleanest way do do this is to go to a 4-level page table for this
> case.  Each page table level using order-0 pages adds 9 bits to the
> VA size (at 4K pages, so for four levels we get 9 * 4 + 12 == 48-bits.
> 
> For the 4K page size case only we add support functions for the PUD
> level of the page table tree, also the TLB exception handlers get an
> extra level of tree walk.
> 
> Signed-off-by: Alex Belits 
> [david.da...@cavium.com] Forward port to v4.10
> Signed-off-by: David Daney 

Thanks folks, queued for 4.12.

While the need for 48-bit address space is not so surprising, the need
for the combination of 4K pages and 48-bit address space is!

I had some minor merge conflicts so it would be good if you could take
a look if 
https://git.linux-mips.org/cgit/ralf/upstream-sfr.git/commit/?id=afba1896993a0b74aa2ad3076d594e455b3af301
looks good.

  Ralf


Re: [PATCH] MIPS: cavium-octeon: Remove vestiges of CONFIG_CAVIUM_OCTEON_2ND_KERNEL

2017-03-15 Thread Ralf Baechle
On Fri, Feb 17, 2017 at 11:45:55AM -0800, David Daney wrote:

> This config option never really worked, and has bit-rotted to the
> point of being completely useless.  Remove it completely.

Thanks, queued for 4.12.

  Ralf


Re: [PATCH v2 0/5] MIPS: BPF: JIT fixes and improvements.

2017-03-15 Thread Ralf Baechle
On Tue, Mar 14, 2017 at 05:34:02PM -0700, David Daney wrote:

> > What tree are you targetting with these changes?  Do you expect
> > them to go via the MIPS or the net-next tree?
> > 
> > Please be explicit about this in the future.
> > 
> 
> Sorry I didn't mention it.
> 
> My expectation is that Ralf would merge it via the MIPS tree, as it is fully
> contained within arch/mips/*

Thanks, applied.

  Ralf


Re: NFS corruption, fixed by echo 1 > /proc/sys/vm/drop_caches -- next debugging steps?

2017-03-15 Thread Ralf Baechle
On Mon, Mar 13, 2017 at 09:47:57AM +, James Hogan wrote:

> > 
> > Note that the corruption is different across reboots, both in the size
> > of the corruption and the location. I saw 1900~ and 1400~ byte
> > sequences corrupted on separate occasions, which don't correspond to
> > the system's 16kB page size.
> > 
> > I've tested kernels from v3.19 to 4.11-rc1+ (master branch from
> > today). All exhibit this behavior with differing frequencies. Earlier
> > kernels seem to reproduce the issue less often, while more recent
> > kernels reliably exhibit the problem every boot.
> > 
> > How can I further debug this?
> 
> It smells a bit like a DMA / caching issue.
> 
> Can you provide a full kernel log. That might provide some information
> about caching that might be relevant (e.g. does dcache have aliases?).

The architecture of the BCM1250 SOC used for the BCM91250 boards are
fully coherent, S-cache and D-cache are physically indexed and tagged.
Only the VIVT (plus the usual ASID tagging) I-cache leaves space for
software to screw up cache management but that shouldn't matter for this
case, so I suggest to start looking into this from the NFS side.

  Ralf


[PATCH] NET: mkiss: Fix panic

2017-02-09 Thread Ralf Baechle
If a USB-to-serial adapter is unplugged, the driver re-initializes, with
dev->hard_header_len and dev->addr_len set to zero, instead of the correct
values.  If then a packet is sent through the half-dead interface, the
kernel will panic due to running out of headroom in the skb when pushing
for the AX.25 headers resulting in this panic:

[] (skb_panic) from [] (skb_push+0x4c/0x50)
[] (skb_push) from [] (ax25_hard_header+0x34/0xf4 [ax25])
[] (ax25_hard_header [ax25]) from [] (ax_header+0x38/0x40 
[mkiss])
[] (ax_header [mkiss]) from [] 
(neigh_compat_output+0x8c/0xd8)
[] (neigh_compat_output) from [] 
(ip_finish_output+0x2a0/0x914)
[] (ip_finish_output) from [] (ip_output+0xd8/0xf0)
[] (ip_output) from [] (ip_local_out_sk+0x44/0x48)

This patch makes mkiss behave like the 6pack driver. 6pack does not
panic.  In 6pack.c sp_setup() (same function name here) the values for
dev->hard_header_len and dev->addr_len are set to the same values as in
my mkiss patch.

[r...@linux-mips.org: Massages original submission to conform to the usual
standards for patch submissions.]

Signed-off-by: Thomas Osterried 
Signed-off-by: Ralf Baechle 

---

 drivers/net/hamradio/mkiss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 1dfe230..e0a6b1a 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -648,8 +648,8 @@ static void ax_setup(struct net_device *dev)
 {
/* Finish setting up the DEVICE info. */
dev->mtu = AX_MTU;
-   dev->hard_header_len = 0;
-   dev->addr_len= 0;
+   dev->hard_header_len = AX25_MAX_HEADER_LEN;
+   dev->addr_len= AX25_ADDR_LEN;
dev->type= ARPHRD_AX25;
dev->tx_queue_len= 10;
dev->header_ops  = &ax25_header_ops;


Re: [Bug fix]mips 64bits checksum error -- csum_tcpudp_nofold

2017-01-26 Thread Ralf Baechle
On Thu, Jan 26, 2017 at 07:57:49AM -0800, Alexander Duyck wrote:
> Date:   Thu, 26 Jan 2017 07:57:49 -0800
> From: Alexander Duyck 
> To: Mark Zhang 
> Cc: Ralf Baechle , David Miller ,
>  Alexander Duyck , linux-m...@linux-mips.org,
>  "linux-kernel@vger.kernel.org" 
> Subject: Re: [Bug fix]mips 64bits checksum error -- csum_tcpudp_nofold
> Content-Type: text/plain; charset=UTF-8
> 
> On Wed, Jan 25, 2017 at 6:33 PM, Mark Zhang  wrote:
> > Hi Alex,
> >
> > Thanks for your reply.
> > I tested your correction. The result is correct.
> > The C language will cause this function(csum_tcpudp_nofold) become
> > 176 MIPS instructions. The assemble code is 150 MIPS instruction.
> > If the MIPS CPU is running as 1GHz, C language cause more 60 nano
> > seconds during send/receive each tcp/udp packet. I'm not sure whether
> > it will cause any negative result if the frequency of CPU was lower.
> > MIPS arch is usually used in networking equipments.
> > I think Ralf's correction is better.
> >
> > - Mark
> >
> > Signed-off-by: Ralf Baechle 
> >
> >  arch/mips/include/asm/checksum.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/mips/include/asm/checksum.h 
> > b/arch/mips/include/asm/checksum.h
> > index 5c585c5..08b6ba3 100644
> > --- a/arch/mips/include/asm/checksum.h
> > +++ b/arch/mips/include/asm/checksum.h
> > @@ -186,7 +186,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr,
> > "   daddu   %0, %4  \n"
> > "   dsll32  $1, %0, 0   \n"
> > "   daddu   %0, $1  \n"
> > +   "   sltu$1, %0, $1  \n"
> > "   dsra32  %0, %0, 0   \n"
> > +   "   daddu   %0, $1  \n"
> >  #endif
> > "   .setpop"
> > : "=r" (sum)
> >
> 
> This looks good to me.
> 
> Acked-by: Alexander Duyck 

I've actually checked in a slightly different version that this which
uses an ADDU rather than a DADDU for the second instruction added.  This
is because the DSRA32 ensures the 32 bit result in %0 is properly
signed extended to 64 bit as required by the MIPS architecture and the
ADDU then simply operates on that 32 bit %0.

  Ralf


Re: [Bug fix]mips 64bits checksum error -- csum_tcpudp_nofold

2017-01-26 Thread Ralf Baechle
On Wed, Jan 25, 2017 at 10:13:32AM -0800, Alexander Duyck wrote:

> On Tue, Jan 24, 2017 at 8:35 PM, Mark Zhang  wrote:
> > If the input parameters as saddr = 0xc0a8fd60,daddr = 0xc0a8fda1,len =
> > 80, proto = 17, sum =0x7eae049d.
> > The correct result should be 1, but original function return 0.
> >
> > Attached the correction patch.
> 
> I've copied your patch here:
> 
> >From 52e265f7fe0acf9a6e9c4346e1fe6fa994aa00b6 Mon Sep 17 00:00:00 2001
> From: qzhang 
> Date: Wed, 25 Jan 2017 12:25:25 +0800
> Subject: [PATCH] Fixed the mips 64bits checksum error -- csum_tcpudp_nofold
> 
> ---
>  arch/mips/include/asm/checksum.h |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/mips/include/asm/checksum.h 
> b/arch/mips/include/asm/checksum.h
> index 7749daf..0e351c5 100644
> --- a/arch/mips/include/asm/checksum.h
> +++ b/arch/mips/include/asm/checksum.h
> @@ -184,6 +184,10 @@ static inline __wsum csum_tcpudp_nofold(__be32
> saddr, __be32 daddr,
>   " daddu %0, %2 \n"
>   " daddu %0, %3 \n"
>   " daddu %0, %4 \n"
> + " dsrl32  $1, %0, 0 \n" # Put upper 32 bits of %0 into $1

> + " dsll32 %0, %0, 0 \n"  # zero upper 32 bits of %0
> + " dsrl32 %0, %0, 0 \n"

> + " daddu   %0, $1 \n"# now add

>   " dsll32 $1, %0, 0 \n"
>   " daddu %0, $1 \n"
>   " dsra32 %0, %0, 0 \n"

See the comments I added into above code.

> I agree there does appear to be a bug in the code, and my
> understanding of MIPS assembly is limited, but I don't think your
> patch truly fixes it.  From what I can understand it seems like you
> would just be shifting the register called out at %0 past 64 bits
> which would just zero it out.

Not quite, DSLL32 is a logic shift left by 32 + x bits where x is the 0..31
constant of the 3rd argument.  Similarly DSRA32 is an arithmetic shift
right by 32 + x bits where x is the 0..31 constant of the 3rd argument.

> Below is the snippet you are updating:
> 
> #ifdef CONFIG_64BIT
> "   daddu   %0, %2  \n"
> "   daddu   %0, %3  \n"
> "   daddu   %0, %4  \n"
> "   dsll32  $1, %0, 0   \n"
> "   daddu   %0, $1  \n"
> "   dsra32  %0, %0, 0   \n"
> #endif
> 
> >From what I can tell the issue is that the dsll32 really needs to be
> replaced with some sort of rotation type call instead of a shift, but
> it looks like MIPS doesn't have a rotation instruction.  We need to
> add the combination of a shift left by 32, to a shift right 32, and
> then add that value back to the original register.  Then we will get
> the correct result in the upper 32 bits.

The DSLL32 is fine.  What the DSLL32 does is moving the low 32 bits of %0
to the upper 32 bits of the target register $1 before the DADDU is adding
both 32 bit halfs of the 64 bit intermediate checksum together.

The real bug is that above inline code was written assuming that when
folding the intermediate 64-bit sum to 32 bit there can not ever be a
carry.

> I'm not even sure it is necessary to use inline assembler.  You could
> probably just use the inline assembler for the 32b and change the 64b
> approach over to using C.  The code for it would be pretty simple:
> unsigned long res = (__force unsigned long)sum;
> 
> res += (__force unsigned long)daddr;
> res += (__force unsigned long)saddr;
> #ifdef __MIPSEL__
> res += (proto + len) << 8;
> #else
> res += proto + len;
> #endif
> res += (res << 32) | (res >> 32);
> 
> return (__force __wsum)(res >> 32);
> 
> That would probably be enough to fix the issue and odds are it should
> generate assembly code very similar to what was already there.

GCC used to do silly things at times which is the sole reason why it
ever made sense to use inline assembler.  No more and compiled C code
can be scheduled better than inline assembler these days.

I have a fix but unlike Mark's original fix it only adds two instructions.

  Ralf


Re: [PATCH v3 0/5] MIPS: Add per-cpu IRQ stack

2017-01-10 Thread Ralf Baechle
On Wed, Jan 11, 2017 at 12:32:38AM +0100, Jason A. Donenfeld wrote:

> Was this ever picked up for 4.10 or 4.11?

Still sitting in -next as commit 3cc3434fd630 and its four parent commits.

  Ralf


Re: arch/mips/vdso/elf.S:1:0: error: '-march=r3000' requires '-mfp32'

2016-12-25 Thread Ralf Baechle
On Sun, Dec 25, 2016 at 09:16:16AM +0800, kbuild test robot wrote:

(dropping Markos who's email address is no longer valid from the cc list.)

> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba
> commit: ebb5e78cc63417a35254a791de66e1cc84f963cc MIPS: Initial implementation 
> of a VDSO
> date:   1 year, 1 month ago
> config: mips-decstation_defconfig (attached as .config)
> compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout ebb5e78cc63417a35254a791de66e1cc84f963cc
> # save the attached .config to linux build tree
> make.cross ARCH=mips 
> 
> All errors (new ones prefixed by >>):
> 
> >> arch/mips/vdso/elf.S:1:0: error: '-march=r3000' requires '-mfp32'
> /*
> 
> --
> >> arch/mips/vdso/sigreturn.S:1:0: error: '-march=r3000' requires '-mfp32'
> /*

This seems to be another toolchain-related issue.  I can't reproduce this
locally, even with the GCC 5.3.0 / binutils 2.25 combination which I
used to reproduce the other recently reported toolchain issues.

  Ralf


Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation

2016-12-21 Thread Ralf Baechle
On Tue, Dec 20, 2016 at 06:50:05PM +0100, Oleg Nesterov wrote:

> >>> Commit:
> >>>
> >>>   72e6ae285a1d ('ARM: 8043/1: uprobes need icache flush after xol write'
> >>>
> >>> ... has introduced an arch-specific method to ensure all caches are
> >>> flushed appropriately after an instruction is written to an XOL page.
> >>
> >> when this page is already mmaped,
> >>
> >>> However, when the XOL area is created and the out-of-line breakpoint
> >>> instruction is copied, caches are not flushed at all and stale data may
> >>> be found in icache.
> >>
> >> but in this case the page is not mmaped yet, the probed application will
> >> take a page fault if it tries to execute this insn,
> >
> > In case of MIPS (and AFAICT ARM as well, and these are the only  
> > architectures that implement arch_uprobe_copy_ixol), the cache flushing  
> > is done through the kernel addresses of that page, so the fact that it  
> > is not mapped yet is not an issue.
> 
> OK, thanks,
> 
> > Do I understand correctly that your statement implies that after the  
> > page fault and mmapping the xol page, the page is guaranteed to be  
> > updated in the cache? As definitely that is not something that is  
> > happening at the moment.
> 
> Well, I do not know. Let me repeat I don't understand this flush_.*cache
> magic.
> 
> But. do_read_fault() does
> 
>   __do_fault(..., &fault_page, ...);
> 
>   alloc_set_pte(fault_page);
> 
> and alloc_set_pte() does flush_icache_page(vma, page)... Hmm, which is nop
> on MIPS.
> 
> >> OK, I know nothing about MIPS, but could you help me understand this 
> >> change?
> >>
> >> See above. If we really need flush_icache_range() here then perhaps we 
> >> should
> >> modify install_special_mapping() and/or __do_fault/special_mapping_fault 
> >> paths
> >> instead?
> >
> > Are you suggesting that those should be updated to force a cache update?
> 
> Again, I do not know. But perhaps it makes more sense to actually implement
> flush_icache_page() ? Otherwise another user of install_special_mapping()
> can hit the same problem?

Documentation/cachetlb.txt says about flush_icache_page:

  void flush_icache_page(struct vm_area_struct *vma, struct page *page)
All the functionality of flush_icache_page can be implemented in
flush_dcache_page and update_mmu_cache. In the future, the hope
is to remove this interface completely.

And that's exactly what MIPS already does, thus flush_icache_page() is a
no-op.  The new interfaces flush_dcache_page and update_mmu_cache
generally are much more efficient.

  Ralf


Re: arch/mips/vdso/elf.S:1:0: error: '-march=r3900' requires '-mfp32'

2016-12-12 Thread Ralf Baechle
On Sun, Dec 11, 2016 at 09:04:48AM +0800, kbuild test robot wrote:

> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   045169816b31b10faed984b01c390db1b32ee4c1
> commit: ebb5e78cc63417a35254a791de66e1cc84f963cc MIPS: Initial implementation 
> of a VDSO
> date:   1 year, 1 month ago
> config: mips-jmr3927_defconfig (attached as .config)
> compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout ebb5e78cc63417a35254a791de66e1cc84f963cc
> # save the attached .config to linux build tree
> make.cross ARCH=mips 

Which binutils are you using with this compiler?

Thanks,

  Ralf


Re: [PATCH 4/4] MIPS/kernel/proc: Combine four seq_printf() calls into one call in show_cpuinfo()

2016-10-25 Thread Ralf Baechle
On Tue, Oct 25, 2016 at 10:55:42AM +0200, Geert Uytterhoeven wrote:

> > -   seq_printf(m, "shadow register sets\t: %d\n",
> > - cpu_data[n].srsets);
> > -   seq_printf(m, "kscratch registers\t: %d\n",
> > - hweight8(cpu_data[n].kscratch_mask));
> > -   seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
> > -   seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
> > +   seq_printf(m,
> > +  "shadow register sets\t: %d\n"
> > +  "kscratch registers\t: %d\n"
> > +  "package\t\t\t: %d\n"
> > +  "core\t\t\t: %d\n",
> > +  cpu_data[n].srsets,
> > +  hweight8(cpu_data[n].kscratch_mask),
> > +  cpu_data[n].package,
> > +  cpu_data[n].core);
> 
> I think the code is much easier to read with separate seq_printf()s for
> each line printed.

Which is why I originally implemented this as separate function calls.
Code size and performance are hardly an argument for /proc/cpuinfo.

  Ralf


[PATCH] Documentation: MIPS supports HAVE_REGS_AND_STACK_ACCESS_API

2016-10-13 Thread Ralf Baechle
This should have been part of 40e084a506eb ('MIPS: Add uprobes support.').

Signed-off-by: Ralf Baechle 
Fixes: 40e084a506eb ("MIPS: Add uprobes support.")
Cc: Jonathan Corbet 
Cc: linux-m...@linux-mips.org
Cc: linux-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Jonathan, you can funnel this through the MIPS tree if you're ok with that?
Just lemme know -- Ralf

 Documentation/features/perf/kprobes-event/arch-support.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/features/perf/kprobes-event/arch-support.txt 
b/Documentation/features/perf/kprobes-event/arch-support.txt
index 9855ad0..4660bf2 100644
--- a/Documentation/features/perf/kprobes-event/arch-support.txt
+++ b/Documentation/features/perf/kprobes-event/arch-support.txt
@@ -22,7 +22,7 @@
 |m68k: | TODO |
 |   metag: | TODO |
 |  microblaze: | TODO |
-|mips: | TODO |
+|mips: |  ok  |
 | mn10300: | TODO |
 |   nios2: | TODO |
 |openrisc: | TODO |


Re: [PATCH v2 17/19] auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays

2016-09-27 Thread Ralf Baechle
On Fri, Aug 26, 2016 at 03:17:49PM +0100, Paul Burton wrote:

> Add a driver for simple ASCII LCD displays found on the MIPS Boston,
> Malta & SEAD3 development boards. The Boston display is an independent
> memory mapped device with a simple memory mapped 8 byte register space
> containing the 8 ASCII characters to display. The Malta display is
> exposed as part of the Malta board registers, and provides 8 registers
> each of which corresponds to one of the ASCII characters to display. The
> SEAD3 display is slightly more complex, exposing an interface to an
> S6A0069 LCD controller via registers provided by the boards CPLD.
> However although the displays differ in their register interface, we
> require similar functionality on each board so abstracting away the
> differences within a single driver allows us to share a significant
> amount of code & ensure consistent behaviour.
> 
> The driver displays the Linux kernel version as the default message, but
> allows the message to be changed via a character device. Messages longer
> then the number of characters that the display can show will scroll.
> 
> This provides different behaviour to the existing LCD display code for
> the MIPS Malta or MIPS SEAD3 platforms in the following ways:
> 
>   - The default string to display is not "LINUX ON MALTA" or "LINUX ON
> SEAD3" but "Linux" followed by the version number of the kernel
> (UTS_RELEASE).
> 
>   - Since that string tends to be significantly longer it scrolls twice
> as fast, moving every 500ms rather than every 1s.
> 
>   - The LCD won't be updated until the driver is probed, so it doesn't
> provide the early "LINUX" string.

Right now parts 15..18 of this series are stalled due to the lack of an
ack for this patch.

Miguel?

  Ralf


Re: [PATCH 2/2] MIPS: set NR_syscall_tables appropriately

2016-09-27 Thread Ralf Baechle
On Mon, Aug 29, 2016 at 11:30:07AM +0200, Marcin Nowakowski wrote:

> Depending on the kernel configuration, up to 3 syscall tables can be
> used in parallel - so set the number properly to ensure syscall tracing
> is set up properly.
> 
> Signed-off-by: Marcin Nowakowski 
> ---
>  arch/mips/include/asm/unistd.h | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
> index e558130..71162f3d 100644
> --- a/arch/mips/include/asm/unistd.h
> +++ b/arch/mips/include/asm/unistd.h
> @@ -22,6 +22,10 @@
>  #define NR_syscalls  (__NR_O32_Linux + __NR_O32_Linux_syscalls)
>  #endif
>  
> +#define NR_syscall_tables (1 + \
> + IS_ENABLED(CONFIG_MIPS32_O32) + \
> + IS_ENABLED(CONFIG_MIPS32_N32))
> +
>  #ifndef __ASSEMBLY__

NR_syscall_tables is a new symbol but I don't see any users of this
symbol?

  Ralf


Re: [PATCH v2 2/6] MIPS: tlb-r4k: If there are wired entries, don't use TLBINVF

2016-09-22 Thread Ralf Baechle
On Tue, Sep 20, 2016 at 09:47:25AM +0100, Matt Redfearn wrote:

> When adding a wired entry to the TLB via add_wired_entry, the tlb is
> flushed with local_flush_tlb_all, which on CPUs with TLBINV results in
> the new wired entry being flushed again.
> 
> Behavior of the TLBINV instruction applies to all applicable TLB entries
> and is unaffected by the setting of the Wired register. Therefore if
> the TLB has any wired entries, fall back to iterating over the entries
> rather than blasting them all using TLBINVF.
> 
> Signed-off-by: Matt Redfearn 

Queued for 4.9..

  Ralf


Re: [PATCH v2 6/6] MIPS: Deprecate VPE Loader

2016-09-20 Thread Ralf Baechle
On Tue, Sep 20, 2016 at 09:47:29AM +0100, Matt Redfearn wrote:

> The MIPS remote processor driver (CONFIG_MIPS_RPROC) provides a more
> standard mechanism for using one or more VPs as coprocessors running
> separate firmware.
> 
> Here we deprecate this mechanism before it is removed.

The world will be a better place once this is removed.

I receive the occasional minor cleanup or robopatch (coccinelle or similar)
for the VPE loader but I have no indication this is actually being used
by anybody, so is thee any reason why not to delete it right away?

  Ralf


Re: [PATCH] MIPS: dec: Avoid la pseudo-instruction in delay slots

2016-09-20 Thread Ralf Baechle
On Mon, Sep 19, 2016 at 11:30:25PM +0100, Maciej W. Rozycki wrote:

> > When expanding the la or dla pseudo-instruction in a delay slot the GNU
> > assembler will complain should the pseudo-instruction expand to multiple
> > actual instructions, since only the first of them will be in the delay
> > slot leading to the pseudo-instruction being only partially executed if
> > the branch is taken. Use of PTR_LA in the dec int-handler.S leads to
> > such warnings:
> > 
> >   arch/mips/dec/int-handler.S: Assembler messages:
> >   arch/mips/dec/int-handler.S:149: Warning: macro instruction expanded into 
> > multiple instructions in a branch delay slot
> >   arch/mips/dec/int-handler.S:198: Warning: macro instruction expanded into 
> > multiple instructions in a branch delay slot
> > 
> > Avoid this by placing nops in the delay slots of the affected branches,
> > leading to the PTR_LA macros being placed after the branches & their
> > delay slots. Although the nop isn't strictly needed, it's an
> > insignificant cost & satisfies the assembler easily with more
> > readable code than the possible alternative of manually expanding the
> > la/dla pseudo-instructions & placing the appropriate first instruction
> > into the delay slots.
> 
>  I take it it's a quest for a clean compilation with no warnings reported, 
> as the message is otherwise harmless and correct code is produced here.
> 
>  Some of the systems affected are not necessarily fast (e.g. clocked at 
> 12MHz), so I wonder if we shouldn't just bite the bullet and expand the 
> %hi/%lo pair here.  Even with R4k DECstations we only support `-msym32' 
> compilation only, due to R4k errata, so it's not like the higher parts 
> will ever be needed for address calculation.
> 
>  Alternatively we could have a `.set warn'/`.set nowarn' setting in GAS, 
> previously discussed I believe, although it would take a bit to propagate.

Yeah, I'm already looking into the other direction whenever this warning
pops up - and it does so often.  I've even pondered submitting something
like -Werror for gas ;-)

It's not very elegant but you could just open code everything, see below
patch.  Compiles but not runtime tested due to lack of hardware.

Maciej, can you test this?

  Ralf

Signed-off-by: Ralf Baechle 

 arch/mips/dec/int-handler.S | 40 ++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S
index d7b9918..20035fc 100644
--- a/arch/mips/dec/int-handler.S
+++ b/arch/mips/dec/int-handler.S
@@ -146,7 +146,25 @@
/*
 * Find irq with highest priority
 */
-PTR_LA t1,cpu_mask_nr_tbl
+   # open coded PTR_LA t1, cpu_mask_nr_tbl
+#if (_MIPS_SZPTR == 32)
+   # open coded la t1, cpu_mask_nr_tbl
+   lui t1, %hi(cpu_mask_nr_tbl)
+   addiu   t1, %lo(cpu_mask_nr_tbl)
+   
+#endif
+#if (_MIPS_SZPTR == 64)
+   # open coded dla t1, cpu_mask_nr_tbl
+   .setpush
+   .setnoat
+   lui t1, %highest(cpu_mask_nr_tbl)
+   lui AT, %hi(cpu_mask_nr_tbl)
+   daddiu  t1, t1, %higher(cpu_mask_nr_tbl)
+   daddiu  AT, AT, %lo(cpu_mask_nr_tbl)
+   dsllt1, 32
+   daddu   t1, t1, AT
+   .setpop
+#endif
 1: lw  t2,(t1)
nop
and t2,t0
@@ -195,7 +213,25 @@
/*
 * Find irq with highest priority
 */
-PTR_LA t1,asic_mask_nr_tbl
+   # open coded PTR_LA t1,asic_mask_nr_tbl
+#if (_MIPS_SZPTR == 32)
+   # open coded la t1, asic_mask_nr_tbl
+   lui t1, %hi(asic_mask_nr_tbl)
+   addiu   t1, %lo(asic_mask_nr_tbl)
+   
+#endif
+#if (_MIPS_SZPTR == 64)
+   # open coded dla t1, asic_mask_nr_tbl
+   .setpush
+   .setnoat
+   lui t1, %highest(asic_mask_nr_tbl)
+   lui AT, %hi(asic_mask_nr_tbl)
+   daddiu  t1, t1, %higher(asic_mask_nr_tbl)
+   daddiu  AT, AT, %lo(asic_mask_nr_tbl)
+   dsllt1, 32
+   daddu   t1, t1, AT
+   .setpop
+#endif
 2: lw  t2,(t1)
nop
and t2,t0


Re: [PATCH 16/21] mips: loongson: smp: Convert to hotplug state machine

2016-09-19 Thread Ralf Baechle
On Tue, Sep 06, 2016 at 07:04:52PM +0200, Sebastian Andrzej Siewior wrote:

> Install the callbacks via the state machine.

Same here, I assume you want to upstream this as a single pull request, so

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH 15/21] mips: octeon: smp: Convert to hotplug state machine

2016-09-19 Thread Ralf Baechle
On Tue, Sep 06, 2016 at 07:04:51PM +0200, Sebastian Andrzej Siewior wrote:

I assume you want to upstream this as a single pull request, so

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH v2] mm: move phys_mem_access_prot_allowed() declaration to pgtable.h

2016-09-16 Thread Ralf Baechle
On Tue, Sep 13, 2016 at 03:26:37PM +0800, Baoyou Xie wrote:

> We get 1 warning when building kernel with W=1:
> drivers/char/mem.c:220:12: warning: no previous prototype for 
> 'phys_mem_access_prot_allowed' [-Wmissing-prototypes]
>  int __weak phys_mem_access_prot_allowed(struct file *file,
> 
> In fact, its declaration is spreading to several header files
> in different architecture, but need to be declare in common
> header file.
> 
> So this patch moves phys_mem_access_prot_allowed() to pgtable.h.
> 
> Signed-off-by: Baoyou Xie 

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH] MIPS: rb532: Fix undefined reference to setup_serial_port

2016-09-13 Thread Ralf Baechle
On Mon, Sep 05, 2016 at 05:18:40PM +0100, Matt Redfearn wrote:

> If the rb532 machine is compiled without CONFIG_SERIAL_8250, the
> following linker error occurs
> 
> arch/mips/built-in.o: In function `setup_serial_port':
> (.init.text+0x20c): undefined reference to `early_serial_setup'
> 
> Fix this by wrapping registration of the rb532 uart in an ifdef
> CONFIG_SERIAL_8250.

This will still fail if CONFIG_SERIAL_8250 = m.

RB532 should be rewritten to use earl console rather than early_serial_setup
similar to 
https://git.linux-mips.org/cgit/ralf/linux.git/commit/?id=194d315da86af504559a8a21026360097575bd55
for example.

  Ralf


Re: [PATCH] MIPS: paravirt: Fix undefined reference to smp_bootstrap

2016-09-13 Thread Ralf Baechle
On Mon, Sep 05, 2016 at 03:43:40PM +0100, Matt Redfearn wrote:

> If the paravirt machine is compiles without CONFIG_SMP, the following
> linker error occurs
> 
> arch/mips/kernel/head.o: In function `kernel_entry':
> (.ref.text+0x10): undefined reference to `smp_bootstrap'
> 
> due to the kernel entry macro always including SMP startup code.
> Wrap this code in CONFIG_SMP to fix the error.
> 
> Signed-off-by: Matt Redfearn 

Thanks, applied.  This patch should be applied to 3.16+ also so I've
added a Cc: stable... tag.

  Ralf

>  arch/mips/include/asm/mach-paravirt/kernel-entry-init.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h 
> b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h
> index 2f82bfa3a773..c9f5769dfc8f 100644
> --- a/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h
> +++ b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h
> @@ -11,11 +11,13 @@
>  #define CP0_EBASE $15, 1
>  
>   .macro  kernel_entry_setup
> +#ifdef CONFIG_SMP
>   mfc0t0, CP0_EBASE
>   andit0, t0, 0x3ff   # CPUNum
>   beqzt0, 1f
>   # CPUs other than zero goto smp_bootstrap
>   j   smp_bootstrap
> +#endif /* CONFIG_SMP */
>  
>  1:
>   .endm
> -- 
> 2.7.4
> 


Re: [PATCH] MIPS: dont specify STACKPROTECTOR in defconfigs

2016-08-04 Thread Ralf Baechle
On Wed, Aug 03, 2016 at 03:03:59PM -0400, Paul Gortmaker wrote:

> Only one defconfig has a STACKPROTECTOR value.  And it asks for
> the strong variant, which isn't supported by older toolchains.
> 
> Due to the nature of MIPS having more platform specific code than say
> x86, the allyesconfig and allmodconfig aren't as effective for build
> coverage.  So, in addition, I like to use a trivial script to walk all
> the defconfigs and build each one.
> 
> However I will get false positives on unsupported stackprotector values
> with an older toolchain like gcc-4.6.3.  As in this instance I am just
> using the compiler as a glorified syntax checker on a machine where I
> build a bunch of other arch for the same reason, there is no real
> motivation to get a newer toolchain for improved optimization etc.
> 
> Since there is only one of them, and there is nothing about these
> settings that are board/platform specific, I propose we just eliminate
> the existing instance and take the default.

Yeah, I can see how that one may get annoying.  I wish there was something
along the lines of KCONFIG_ALLCONFIG that was working not only for
allyesconfig/allmodconfig/allnoconfig/randconfig.

Applied.  Thanks,

  Ralf


Re: [PATCH] MIPS: Loongson1B: Provide DMA filter callbacks via platform data

2016-08-02 Thread Ralf Baechle
On Sat, May 28, 2016 at 05:51:52PM +0800, Keguang Zhang wrote:

> diff --git a/arch/mips/include/asm/mach-loongson32/nand.h 
> b/arch/mips/include/asm/mach-loongson32/nand.h
> index e274912..a1f8704 100644
> --- a/arch/mips/include/asm/mach-loongson32/nand.h
> +++ b/arch/mips/include/asm/mach-loongson32/nand.h
> @@ -21,10 +21,9 @@ struct plat_ls1x_nand {
>  
>   int hold_cycle;
>   int wait_cycle;
> + bool (*dma_filter)(struct dma_chan *chan, void *param);
>  };
>  
>  extern struct plat_ls1x_nand ls1b_nand_pdata;
>  
> -bool ls1x_dma_filter_fn(struct dma_chan *chan, void *param);
> -
>  #endif /* __ASM_MACH_LOONGSON32_NAND_H */
> diff --git a/arch/mips/loongson32/ls1b/board.c 
> b/arch/mips/loongson32/ls1b/board.c
> index 38a1d40..0a57337 100644
> --- a/arch/mips/loongson32/ls1b/board.c
> +++ b/arch/mips/loongson32/ls1b/board.c
> @@ -38,6 +38,7 @@ struct plat_ls1x_nand ls1x_nand_pdata = {
>   .nr_parts   = ARRAY_SIZE(ls1x_nand_parts),
>   .hold_cycle = 0x2,
>   .wait_cycle = 0xc,
> + .dma_filter = ls1x_dma_filter,
>  };

Without the DMA driver which Vinod has requested changes for this
patch will result in build errors.  It will also result in a build
error if CONFIG_LOONGSON1_DMA is disabled.

  Ralf


Re: [PATCH] mips: lantiq: fix irq_chip name to not land in new parent field

2016-08-02 Thread Ralf Baechle
On Tue, Aug 02, 2016 at 02:54:47PM -0400, Paul Gortmaker wrote:

> As of commit be45beb2df69 ("genirq: Add runtime power management
> support for IRQ chips") the irq_chip struct got a struct *device
> parent_device field added to it.  However, it was added at the
> beginning of the struct, which previously was the "name" entry.
> 
> The driver here was using a mix of ordered struct init entries and
> named init entries.  It was supplying the name assuming it was the 1st
> in the order, and hence when that became a struct *device we get:
> 
> arch/mips/lantiq/irq.c:209:2: warning: initialization from incompatible 
> pointer type [enabled by default]
> arch/mips/lantiq/irq.c:209:2: warning: (near initialization for 
> 'ltq_irq_type.parent_device') [enabled by default]
> arch/mips/lantiq/irq.c:219:2: warning: initialization from incompatible 
> pointer type [enabled by default]
> arch/mips/lantiq/irq.c:219:2: warning: (near initialization for 
> 'ltq_eiu_type.parent_device') [enabled by default]
> 
> While not runtime tested, I can't imagine trying to dereference a
> a struct device field from a char string will end well.
> 
> Here we've used named element init entries for the name string as well
> to fix it.
> 
> Fixes: be45beb2df69 ("genirq: Add runtime power management support for IRQ 
> chips")
> Cc: Jon Hunter 
> Cc: Kevin Hilman 
> Cc: Marc Zyngier 
> Cc: John Crispin 
> Cc: Ralf Baechle 
> Cc: Thomas Gleixner 
> Cc: linux-m...@linux-mips.org
> Signed-off-by: Paul Gortmaker 

Thanks for the patch but I've already applied the identical patch
https://patchwork.linux-mips.org/patch/13684/.

  Ralf


Re: [PATCH v3] MIPS: Use CPHYSADDR to implement mips32 __pa

2016-08-02 Thread Ralf Baechle

Thanks, I've replaced the old patch with this one.

  Ralf


Re: [PATCH 0014/1285] Replace numeric parameter like 0444 with macro

2016-08-02 Thread Ralf Baechle
On Tue, Aug 02, 2016 at 06:34:21PM +0800, Baole Ni wrote:

> I find that the developers often just specified the numeric value
> when calling a macro which is defined with a parameter for access permission.
> As we know, these numeric value for access permission have had the 
> corresponding macro,
> and that using macro can improve the robustness and readability of the code,
> thus, I suggest replacing the numeric parameter with the macro.
> 
> Signed-off-by: Chuansheng Liu 
> Signed-off-by: Baole Ni 
> ---
>  arch/mips/txx9/generic/7segled.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/txx9/generic/7segled.c 
> b/arch/mips/txx9/generic/7segled.c
> index 566c58b..1fcd1ec 100644
> --- a/arch/mips/txx9/generic/7segled.c
> +++ b/arch/mips/txx9/generic/7segled.c
> @@ -55,8 +55,8 @@ static ssize_t raw_store(struct device *dev,
>   return size;
>  }
>  
> -static DEVICE_ATTR(ascii, 0200, NULL, ascii_store);
> -static DEVICE_ATTR(raw, 0200, NULL, raw_store);
> +static DEVICE_ATTR(ascii, S_IWUSR, NULL, ascii_store);
> +static DEVICE_ATTR(raw, S_IWUSR, NULL, raw_store);
>  
>  static ssize_t map_seg7_show(struct device *dev,
>struct device_attribute *attr,
> @@ -76,7 +76,7 @@ static ssize_t map_seg7_store(struct device *dev,
>   return size;
>  }
>  
> -static DEVICE_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store);
> +static DEVICE_ATTR(map_seg7, S_IRUSR | S_IWUSR, map_seg7_show, 
> map_seg7_store);
>  
>  static struct bus_type tx_7segled_subsys = {
>   .name   = "7segled",

I find this one of the case where the number is much understandable than
a cryptic symbol whos name was chosen when C compilers still had
limitations on the symbol length and every byte was sacred.

  Ralf


Re: [PATCH v2] MIPS: Use CPHYSADDR to implement mips32 __pa

2016-08-02 Thread Ralf Baechle
On Mon, Aug 01, 2016 at 05:51:10PM +0100, Paul Burton wrote:

> Any thoughts on this one? It matters for Boston (where it affects the
> pch_gbe ethernet driver) which I'll be submitting again for the 4.9 cycle.

I'm sorry.  I meant to leave this one for a while for people to comment
but then it fell through the cracks.  Applied.

Thanks!

  Ralf


Re: [patch 53/66] MIPS: Loongson-3: Convert oprofile to hotplug state machine

2016-07-11 Thread Ralf Baechle
Thank, looks ok.  I assume you want to merge this with the remainder of
of the series, so:

Acked-by: Ralf Baechle 

  Ralf


Re: [PATCH] MIPS: lib: Mark intrinsics notrace

2016-05-29 Thread Ralf Baechle
On Wed, May 25, 2016 at 11:06:35AM +0100, Harvey Hunt wrote:

> On certain MIPS32 devices, the ftrace tracer "function_graph" uses
> __lshrdi3() during the capturing of trace data. ftrace then attempts to
> trace __lshrdi3() which leads to infinite recursion and a stack overflow.
> Fix this by marking __lshrdi3() as notrace. Mark the other compiler
> intrinsics as notrace in case the compiler decides to use them in the
> ftrace path.

Makes perfect sense - but I'm wondering how you triggered it.  Was this
a build with the GCC option -Os that is CONFIG_CC_OPTIMIZE_FOR_SIZE?
Usually people build with CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE that is -O2
which results in intrinsics being inlined.

  Ralf


Re: [PATCH]: ELF/MIPS build fix

2016-05-20 Thread Ralf Baechle
On Fri, May 20, 2016 at 05:37:17PM +0100, Maciej W. Rozycki wrote:

> > CONFIG_MIPS32_N32=y but CONFIG_BINFMT_ELF disabled results in the following
> > linker errors:
> 
>  Is this for a configuration with native (n64) ELF disabled, but one or 
> more compat ELF formats (o32, n32) enabled?  An interesting use case then.

Yes.  Fairly sensible for one of those systems where we only support 64 bit
kernels but don't need a 64 bit userland.

  Ralf


[PATCH]: ELF/MIPS build fix

2016-05-20 Thread Ralf Baechle
CONFIG_MIPS32_N32=y but CONFIG_BINFMT_ELF disabled results in the following
linker errors:

arch/mips/built-in.o: In function `elf_core_dump':
binfmt_elfn32.c:(.text+0x23dbc): undefined reference to `elf_core_extra_phdrs'
binfmt_elfn32.c:(.text+0x246e4): undefined reference to 
`elf_core_extra_data_size'
binfmt_elfn32.c:(.text+0x248d0): undefined reference to 
`elf_core_write_extra_phdrs'
binfmt_elfn32.c:(.text+0x24ac4): undefined reference to 
`elf_core_write_extra_data'

CONFIG_MIPS32_O32=y but CONFIG_BINFMT_ELF disabled results in the following
linker errors:

arch/mips/built-in.o: In function `elf_core_dump':
binfmt_elfo32.c:(.text+0x28a04): undefined reference to `elf_core_extra_phdrs'
binfmt_elfo32.c:(.text+0x29330): undefined reference to 
`elf_core_extra_data_size'
binfmt_elfo32.c:(.text+0x2951c): undefined reference to 
`elf_core_write_extra_phdrs'
binfmt_elfo32.c:(.text+0x29710): undefined reference to 
`elf_core_write_extra_data'

This is because binfmt_elfn32 and binfmt_elfo32 are using symbols
from elfcore but for these configurations elfcore will not be built.

Fixed by making elfcore selectable by a separate config symbol which
unlike the current mechanism can also be used from other directories
than kernel/, then having each flavor of ELF that relies on elfcore.o,
select it in Kconfig, including CONFIG_MIPS32_N32 and CONFIG_MIPS32_O32
which fixes this issue.

Signed-off-by: Ralf Baechle 
---
 arch/mips/Kconfig | 1 +
 fs/Kconfig.binfmt | 8 
 kernel/Makefile   | 4 +---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 5663f41..f19e15c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3116,6 +3116,7 @@ config MIPS32_N32
 config BINFMT_ELF32
bool
default y if MIPS32_O32 || MIPS32_N32
+   select ELFCORE
 
 endmenu
 
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 2d0cbbd..72c0335 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -1,6 +1,7 @@
 config BINFMT_ELF
bool "Kernel support for ELF binaries"
depends on MMU && (BROKEN || !FRV)
+   select ELFCORE
default y
---help---
  ELF (Executable and Linkable Format) is a format for libraries and
@@ -26,6 +27,7 @@ config BINFMT_ELF
 config COMPAT_BINFMT_ELF
bool
depends on COMPAT && BINFMT_ELF
+   select ELFCORE
 
 config ARCH_BINFMT_ELF_STATE
bool
@@ -34,6 +36,7 @@ config BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries"
default y
depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || C6X)
+   select ELFCORE
help
  ELF FDPIC binaries are based on ELF, but allow the individual load
  segments of a binary to be located in memory independently of each
@@ -43,6 +46,11 @@ config BINFMT_ELF_FDPIC
 
  It is also possible to run FDPIC ELF binaries on MMU linux also.
 
+config ELFCORE
+   bool
+   help
+ This option enables kernel/elfcore.o.
+
 config CORE_DUMP_DEFAULT_ELF_HEADERS
bool "Write ELF core dumps with partial segments"
default y
diff --git a/kernel/Makefile b/kernel/Makefile
index f0c40bf..e2ec54e 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -91,9 +91,7 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
 obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
 obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
 obj-$(CONFIG_LATENCYTOP) += latencytop.o
-obj-$(CONFIG_BINFMT_ELF) += elfcore.o
-obj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o
-obj-$(CONFIG_BINFMT_ELF_FDPIC) += elfcore.o
+obj-$(CONFIG_ELFCORE) += elfcore.o
 obj-$(CONFIG_FUNCTION_TRACER) += trace/
 obj-$(CONFIG_TRACING) += trace/
 obj-$(CONFIG_TRACE_CLOCK) += trace/


Re: [PATCH 0/3] External Interrupt Controller (EIC) fixes

2016-05-19 Thread Ralf Baechle
On Thu, May 19, 2016 at 11:21:22AM +0200, Thomas Gleixner wrote:

> On Tue, 17 May 2016, Paul Burton wrote:
> 
> > This series fixes a few small issues with support for External Interrupt
> > Controllers (cpu_has_veic), ensuring that it is configured to service
> > all interrupts by default & that when a GIC is present it's enabled when
> > expected.
> > 
> > Applies atop v4.6.
> > 
> > Paul Burton (3):
> >   MIPS: Clear Status IPL field when using EIC
> >   MIPS: smp-cps: Clear Status IPL field when using EIC
> >   irqchip: mips-gic: Setup EIC mode on each CPU if it's in use
> 
> I was not on CC for patch 1/3 and I assume this should go through one
> tree. Ralf, can you pick that up with my acked-by for the irqchip change?

Yes, will do.

Thanks!

  Ralf


Re: [PATCH] MIPS: perf: Fix I6400 event numbers

2016-05-17 Thread Ralf Baechle
On Mon, May 16, 2016 at 07:32:35PM +0100, James Hogan wrote:

> Fix perf hardware performance counter event numbers for I6400. This core
> does not follow the performance event numbering scheme of previous MIPS
> cores. All performance counters (both odd and even) are capable of
> counting any of the available events.
> 
> Fixes: 4e88a8621301 ("MIPS: Add cases for CPU_I6400")

Thanks, applied.

  Ralf


Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.

2016-05-17 Thread Ralf Baechle
On Tue, May 17, 2016 at 10:35:52AM +0530, Purna Chandra Mandal wrote:

> PIC32 clock driver is now implemented as platform driver instead of
> as part of of_clk_init(). It meants all the clock modules are available
> quite late in the boot sequence. So request for CPU clock by clk_get_sys()
> and clk_get_rate() to find c0_timer rate fails.
> 
> To fix this use PIC32 specific early clock functions implemented for early
> console support.
> 
> Signed-off-by: Purna Chandra Mandal 
> 
> ---
> Note: Please pull this complete series through the MIPS tree.
> 
> ---
> 
>  arch/mips/pic32/pic32mzda/time.c | 13 -

For now I applied only this patch as it seems independent of the remainder
of the series which still will need to be reviewed and acked by the
respective maintainers.

  Ralf


Re: [PATCH 3/3] USB: ohci-jz4740: Remove obsolete driver

2016-05-13 Thread Ralf Baechle
Maarten,

if you submit a USB change to the USB mailing list and maintainer the
probability for the maintainer to ack this patch will actuall rise
significantly ;-)

Greg, I assume this patch is ok to merge or do you want to funnel it
hrough your tree?  I think it would be good to take this through the
MIPS tree together with the remainder of the series.

  Ralf

On Mon, Apr 18, 2016 at 08:58:53PM +0200, Maarten ter Huurne wrote:

> The ohci-platform driver can control the clock, while usb-nop-xceiv
> as the PHY can control the vbus regulator. So this JZ4740-specific
> glue is not needed anymore.
> 
> Signed-off-by: Maarten ter Huurne 
> ---
>  drivers/usb/host/ohci-hcd.c|   5 -
>  drivers/usb/host/ohci-jz4740.c | 245 
> -
>  2 files changed, 250 deletions(-)
>  delete mode 100644 drivers/usb/host/ohci-jz4740.c
> 
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index 04dcedf..0449235 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1245,11 +1245,6 @@ MODULE_LICENSE ("GPL");
>  #define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver
>  #endif
>  
> -#ifdef CONFIG_MACH_JZ4740
> -#include "ohci-jz4740.c"
> -#define PLATFORM_DRIVER  ohci_hcd_jz4740_driver
> -#endif
> -
>  #ifdef CONFIG_TILE_USB
>  #include "ohci-tilegx.c"
>  #define PLATFORM_DRIVER  ohci_hcd_tilegx_driver
> diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c
> deleted file mode 100644
> index 4db78f1..000
> --- a/drivers/usb/host/ohci-jz4740.c
> +++ /dev/null
> @@ -1,245 +0,0 @@
> -/*
> - *  Copyright (C) 2010, Lars-Peter Clausen 
> - *
> - *  This program is free software; you can redistribute it and/or modify it
> - *  under  the terms of the GNU General  Public License as published by the
> - *  Free Software Foundation;  either version 2 of the License, or (at your
> - *  option) any later version.
> - *
> - *  You should have received a copy of the  GNU General Public License along
> - *  with this program; if not, write  to the Free Software Foundation, Inc.,
> - *  675 Mass Ave, Cambridge, MA 02139, USA.
> - *
> - */
> -
> -#include 
> -#include 
> -#include 
> -
> -struct jz4740_ohci_hcd {
> - struct ohci_hcd ohci_hcd;
> -
> - struct regulator *vbus;
> - bool vbus_enabled;
> - struct clk *clk;
> -};
> -
> -static inline struct jz4740_ohci_hcd *hcd_to_jz4740_hcd(struct usb_hcd *hcd)
> -{
> - return (struct jz4740_ohci_hcd *)(hcd->hcd_priv);
> -}
> -
> -static inline struct usb_hcd *jz4740_hcd_to_hcd(struct jz4740_ohci_hcd 
> *jz4740_ohci)
> -{
> - return container_of((void *)jz4740_ohci, struct usb_hcd, hcd_priv);
> -}
> -
> -static int ohci_jz4740_start(struct usb_hcd *hcd)
> -{
> - struct ohci_hcd *ohci = hcd_to_ohci(hcd);
> - int ret;
> -
> - ret = ohci_init(ohci);
> - if (ret < 0)
> - return ret;
> -
> - ohci->num_ports = 1;
> -
> - ret = ohci_run(ohci);
> - if (ret < 0) {
> - dev_err(hcd->self.controller, "Can not start %s",
> - hcd->self.bus_name);
> - ohci_stop(hcd);
> - return ret;
> - }
> - return 0;
> -}
> -
> -static int ohci_jz4740_set_vbus_power(struct jz4740_ohci_hcd *jz4740_ohci,
> - bool enabled)
> -{
> - int ret = 0;
> -
> - if (!jz4740_ohci->vbus)
> - return 0;
> -
> - if (enabled && !jz4740_ohci->vbus_enabled) {
> - ret = regulator_enable(jz4740_ohci->vbus);
> - if (ret)
> - dev_err(jz4740_hcd_to_hcd(jz4740_ohci)->self.controller,
> - "Could not power vbus\n");
> - } else if (!enabled && jz4740_ohci->vbus_enabled) {
> - ret = regulator_disable(jz4740_ohci->vbus);
> - }
> -
> - if (ret == 0)
> - jz4740_ohci->vbus_enabled = enabled;
> -
> - return ret;
> -}
> -
> -static int ohci_jz4740_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 
> wValue,
> - u16 wIndex, char *buf, u16 wLength)
> -{
> - struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd);
> - int ret = 0;
> -
> - switch (typeReq) {
> - case SetPortFeature:
> - if (wValue == USB_PORT_FEAT_POWER)
> - ret = ohci_jz4740_set_vbus_power(jz4740_ohci, true);
> - break;
> - case ClearPortFeature:
> - if (wValue == USB_PORT_FEAT_POWER)
> - ret = ohci_jz4740_set_vbus_power(jz4740_ohci, false);
> - break;
> - }
> -
> - if (ret)
> - return ret;
> -
> - return ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
> -}
> -
> -
> -static const struct hc_driver ohci_jz4740_hc_driver = {
> - .description =  hcd_name,
> - .product_desc = "JZ4740 OHCI",
> - .hcd_priv_size =sizeof(struct jz4740_ohci_hcd),
> -
> - /*
> -  * generic hardware linkage
> -  */
> - .irq =  

Re: [PATCH v11 0/3] PIC32MZDA Clock Driver

2016-05-13 Thread Ralf Baechle
On Fri, May 13, 2016 at 01:22:38PM +0530, Purna Chandra Mandal wrote:

Thanks for resolving the remaining issues.  As per discussion of the
last version I've now queued the entire series for 4.7.

One step closer to full PIC32MZDA in-tree support!

  Ralf


Re: [PATCH] MIPS: ath79: Remove CLK_IS_ROOT

2016-05-11 Thread Ralf Baechle
On Tue, Apr 19, 2016 at 06:33:21PM -0700, Stephen Boyd wrote:

> This flag is a no-op now (see commit 47b0eeb3dc8a "clk: Deprecate
> CLK_IS_ROOT", 2016-02-02) so remove it.
> 
> Cc: Antony Pavlov 
> Signed-off-by: Stephen Boyd 

Thanks, applied.

  Ralf


Re: [PATCH] MIPS: alchemy: Remove CLK_IS_ROOT

2016-05-11 Thread Ralf Baechle
On Tue, Apr 19, 2016 at 06:34:37PM -0700, Stephen Boyd wrote:

> This flag is a no-op now (see commit 47b0eeb3dc8a "clk: Deprecate
> CLK_IS_ROOT", 2016-02-02) so remove it.
> 
> Cc: Manuel Lauss 
> Signed-off-by: Stephen Boyd 

Thanks, applied.

  Ralf


Re: [PATCH] MIPS: Allow R6 compact branch policy to be left unspecified

2016-05-11 Thread Ralf Baechle
I was wondering if we should simply probe for the availability of the
GCC option and not use it, if using an older GCC, then change the
help text for the option accordingly.  This approach would allow
make randconfig or similar to work as expected with older compilers.

  Ralf


  1   2   3   4   5   6   7   8   >