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=154783680019904=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 *)[0], sizeof(envstr), "usbmode");
+   snprintf([0], sizeof(envstr), "usbmode");
 
/* set default host mode */
val = 1;
 
/* get environment string */
-   strp = prom_getenv((char *)[0]);
+   strp = prom_getenv([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_interrupt)
-   show_regs((struct pt_regs *)regs);
+   show_regs(regs);
 }
 
 static int ip28_be_handler(struct pt_regs *regs, int is_fixup)


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 *)[0], sizeof(envstr), "usbmode");
+   snprintf([0], sizeof(envstr), "usbmode");
 
/* set default host mode */
val = 1;
 
/* get environment string */
-   strp = prom_getenv((char *)[0]);
+   strp = prom_getenv([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_interrupt)
-   show_regs((struct pt_regs *)regs);
+   show_regs(regs);
 }
 
 static int ip28_be_handler(struct pt_regs *regs, int is_fixup)


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: [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 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 <jiaxun.y...@flygoat.com>
> To: James Hogan <jho...@kernel.org>
> Cc: Ralf Baechle <r...@linux-mips.org>, linux-m...@linux-mips.org, Huacai
>  Chan <che...@lemote.com>, linux-kernel@vger.kernel.org, Jiaxun Yang
>  <jiaxun.y...@flygoat.com>
> 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 <jiaxun.y...@flygoat.com>
> ---
>  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 <jiaxun.y...@flygoat.com>
> +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 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 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] 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 <matt.redfe...@mips.com>
> > Cc: <sta...@vger.kernel.org> # 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 <r...@linux-mips.org>
Reported-by: Matt Redfearn <matt.redfe...@mips.com>
Suggested-by: James Hogan <james.ho...@mips.com>

 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] 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 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 = _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 = _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 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 = _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 = _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 = 

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 

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  

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  

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 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 <keesc...@chromium.org>
> Acked-by: Geert Uytterhoeven <ge...@linux-m68k.org> # 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 <r...@linux-mips.org>

Thanks,

  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 <r...@linux-mips.org>
> Cc: Wim Van Sebroeck <w...@iguana.be>
> Cc: Guenter Roeck <li...@roeck-us.net>
> Cc: Geert Uytterhoeven <ge...@linux-m68k.org>
> Cc: linux-m...@linux-mips.org
> Cc: linux-watch...@vger.kernel.org
> Signed-off-by: Kees Cook <keesc...@chromium.org>
> ---
>  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 <r...@linux-mips.org>

  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 <mho...@suse.com>
> 
> 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 <ys...@users.sourceforge.jp>
> Cc: Ralf Baechle <r...@linux-mips.org>
> Cc: David Howells <dhowe...@redhat.com>
> Cc: Rich Felker <dal...@libc.org>
> Cc: Jeff Dike <jd...@addtoit.com>
> Cc: Richard Weinberger <rich...@nod.at>
> Cc: Ingo Molnar <mi...@kernel.org>
> Cc: <uclinux-h8-de...@lists.sourceforge.jp>
> Cc: <linux-m...@linux-mips.org>
> Cc: <linux...@vger.kernel.org>
> Signed-off-by: Michal Hocko <mho...@suse.com>

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 <r...@linus-mips.org>

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

Thanks,

  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] 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 <r...@linux-mips.org>

  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 <r...@linux-mips.org>

  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 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 <r...@linux-mips.org>
> Cc: Ingo Molnar <mi...@kernel.org>
> Cc: Arnd Bergmann <a...@arndb.de>
> Cc: linux-m...@linux-mips.org
> Signed-off-by: Kees Cook <keesc...@chromium.org>
> ---
>  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(_timer, jiffies + data);
> + mod_timer(_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(_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(_timer);
> - blink_timer.function = blink_timeout;
> + setup_timer(_timer, blink_timeout, 0);
>   atomic_notifier_chain_register(_notifier_list, _block);
>  
>   return 0;

  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(_timer, jiffies + data);
> + mod_timer(_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(_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(_timer);
> - blink_timer.function = blink_timeout;
> + setup_timer(_timer, blink_timeout, 0);
>   atomic_notifier_chain_register(_notifier_list, _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 <r...@linux-mips.org>
> Cc: James Hogan <james.ho...@imgtec.com>
> Cc: Ingo Molnar <mi...@kernel.org>
> Cc: Paul Gortmaker <paul.gortma...@windriver.com>
> Cc: linux-m...@linux-mips.org
> Signed-off-by: Kees Cook <keesc...@chromium.org>
> ---
>  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(_timer, jiffies + data);
> + mod_timer(_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(_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(_timer);
> - blink_timer.function = blink_timeout;
> + setup_timer(_timer, blink_timeout, 0);
>   atomic_notifier_chain_register(_notifier_list, _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(_timer, jiffies + data);
> + mod_timer(_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(_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(_timer);
> - blink_timer.function = blink_timeout;
> + setup_timer(_timer, blink_timeout, 0);
>   atomic_notifier_chain_register(_notifier_list, _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(>dev, sizeof(struct i596_private),
> -  (void *)lp->dma, lp->dma_addr);
> + dma_free_attrs(>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), >dma_addr, GFP_KERNEL);
> + dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
> +   >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 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(>dev, sizeof(struct i596_private),
> -  (void *)lp->dma, lp->dma_addr);
> + dma_free_attrs(>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), >dma_addr, GFP_KERNEL);
> + dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
> +   >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 <r...@linux-mips.org>

  Ralf


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: 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 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 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 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: <MAX|MAXA|MIN|MINA>.<D|S>: 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 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 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 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 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 <r...@linux-mips.org>

for the whole series.

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: [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 <r...@linux-mips.org>

Thanks,

  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 <r...@linux-mips.org>

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(_affinity, affinity);
> + for_each_cpu(cpu, affinity)
> + if (cpu_data[cpu].package > 0)
> + cpumask_clear_cpu(cpu, _affinity);
> +
> + if (cpumask_empty(_affinity))
> + return -EINVAL;
> +
> + cpumask_copy(d->common->affinity, _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(, irqd->common->affinity, cpu_active_mask);
> + if (cpumask_empty()) {
> + 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]], 
> );
> + if (irq_cpu[ht_irq[i]] >= nr_cpu_ids)
> + irq_cpu[ht_irq[i]] = cpumask_first();
> +
> + 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
> --- 

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(_affinity, affinity);
> + for_each_cpu(cpu, affinity)
> + if (cpu_data[cpu].package > 0)
> + cpumask_clear_cpu(cpu, _affinity);
> +
> + if (cpumask_empty(_affinity))
> + return -EINVAL;
> +
> + cpumask_copy(d->common->affinity, _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(, irqd->common->affinity, cpu_active_mask);
> + if (cpumask_empty()) {
> + 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]], 
> );
> + if (irq_cpu[ht_irq[i]] >= nr_cpu_ids)
> + irq_cpu[ht_irq[i]] = cpumask_first();
> +
> + 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/irq-i8259.c
> @@ -46,6 +46,9 @@ static struct 

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)   += 

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 
> > 

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 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 <matt.redfe...@imgtec.com>
> Signed-off-by: Palmer Dabbelt <pal...@dabbelt.com>

Thanks, nice cleanup!

Acked-by: Ralf Baechle <r...@linux-mips.org>

  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 <r...@linux-mips.org>

  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] 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 <nicsta...@gmail.com>

Acked-by: Ralf Baechle <r...@linux-mips.org>

Feel free to push this to Linus.

  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: 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: 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: 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] 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 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] 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 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 <matt.redfe...@imgtec.com>

Acked-by: Ralf Baechle <r...@linux-mips.org>

  Ralf


  1   2   3   4   5   6   7   8   9   10   >