Final MIPS fixes for 4.15

Some final MIPS fixes for 4.15, including important build fixes and a
 MAINTAINERS update:
 
 - Add myself as MIPS co-maintainer.
 - Fix various all*config build failures (particularly as a result of
   switching the default MIPS platform to the "generic" platform).
 - Fix GCC7 build failures (duplicate const and questionable calls to
   missing __multi3 intrinsic on mips64r6).
 - Fix warnings when CPU Idle is enabled (4.14).
 - Fix AR7 serial output (since 3.17).
 - Fix ralink platform_get_irq error checking (since 3.12).
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAlpiZcsACgkQbAtpk944
 dnrjZA/+LOgEap7GeBrtc38PjpG+a2RFbfZ8EOIVWXcUkZmxX7Uf3NMQk5JH/f4H
 ESgxwHeueorOmRuZm1QJMK1fafwc0ZzMOCXUL+oOXJn5iZ9RRxhSYms0AeQqZ3Sl
 ueAOxI9qP0YUcHc0CU50csLgZsdz/IMZcp/s8MwNai001HvyThjGLw1BeKPKiwD6
 0Yzf5aVhAmUtUy5gSXaI1vNXN97o8XdUb71ivPWJ79mHhvmcDfLjHDoTInhSj5mM
 DiLtMwRVGOAlPWXG5b63LhDfsRr0XW6zNnwqd5SK06O5jAE48jJkhWVFIqX/U4eh
 IianE3IAY263TimeLbjcG+poJ4tWAoyvD0c4hirW9Sf8chVrT3nnZ+aegD6YflHg
 aQjvshg7y8ciKqfSQO2kSA/F/5z0dQcs/63pMTDFv0mrJG5pDi6/EzAez8e20yzO
 Iyl8O4aQleTyY7Hr3mfiUCT305xU9+cgGEmRquKyI1cPNr4ITuuZBQSlanoPDXdk
 mLoaK7W+RC78DWVNfmFBvj3ewrExQl/aQZ8MEaFx2tRde9PN8htfvc6YT8aDxHBZ
 UcBrnc8BjYRtvU75yOmSgaDEg4zfTpwohzlNBcB3qaZbQmOanRiXzmN7o13HCZRr
 MWd1ELHX4PFhrEOsEsfB0G+ep6hsEyhlVlbHPij5u8lY3JA+iLM=
 =rHbt
 -----END PGP SIGNATURE-----

Merge tag 'mips_fixes_4.15_2' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips

Pull MIPS fixes from James Hogan:
 "Some final MIPS fixes for 4.15, including important build fixes and a
  MAINTAINERS update:

   - Add myself as MIPS co-maintainer.

   - Fix various all*config build failures (particularly as a result of
     switching the default MIPS platform to the "generic" platform).

   - Fix GCC7 build failures (duplicate const and questionable calls to
     missing __multi3 intrinsic on mips64r6).

   - Fix warnings when CPU Idle is enabled (4.14).

   - Fix AR7 serial output (since 3.17).

   - Fix ralink platform_get_irq error checking (since 3.12)"

* tag 'mips_fixes_4.15_2' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips:
  MAINTAINERS: Add James as MIPS co-maintainer
  MIPS: Fix undefined reference to physical_memsize
  MIPS: Implement __multi3 for GCC7 MIPS64r6 builds
  MIPS: mm: Fix duplicate "const" on insn_table_MM
  MIPS: CM: Drop WARN_ON(vp != 0)
  MIPS: ralink: Fix platform_get_irq's error checking
  MIPS: Fix CPS SMP NS16550 UART defaults
  MIPS: BCM47XX Avoid compile error with MIPS allnoconfig
  MIPS: RB532: Avoid undefined mac_pton without GENERIC_NET_UTILS
  MIPS: RB532: Avoid undefined early_serial_setup() without SERIAL_8250_CONSOLE
  MIPS: ath25: Avoid undefined early_serial_setup() without SERIAL_8250_CONSOLE
  MIPS: AR7: ensure the port type's FCR value is used
This commit is contained in:
Linus Torvalds 2018-01-20 11:37:00 -08:00
commit e6252e7f58
13 changed files with 108 additions and 12 deletions

View file

@ -9085,6 +9085,7 @@ F: drivers/usb/image/microtek.*
MIPS MIPS
M: Ralf Baechle <ralf@linux-mips.org> M: Ralf Baechle <ralf@linux-mips.org>
M: James Hogan <jhogan@kernel.org>
L: linux-mips@linux-mips.org L: linux-mips@linux-mips.org
W: http://www.linux-mips.org/ W: http://www.linux-mips.org/
T: git git://git.linux-mips.org/pub/scm/ralf/linux.git T: git git://git.linux-mips.org/pub/scm/ralf/linux.git

View file

@ -259,6 +259,7 @@ config BCM47XX
select LEDS_GPIO_REGISTER select LEDS_GPIO_REGISTER
select BCM47XX_NVRAM select BCM47XX_NVRAM
select BCM47XX_SPROM select BCM47XX_SPROM
select BCM47XX_SSB if !BCM47XX_BCMA
help help
Support for BCM47XX based boards Support for BCM47XX based boards
@ -389,6 +390,7 @@ config LANTIQ
select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_MIPS16 select SYS_SUPPORTS_MIPS16
select SYS_SUPPORTS_MULTITHREADING select SYS_SUPPORTS_MULTITHREADING
select SYS_SUPPORTS_VPE_LOADER
select SYS_HAS_EARLY_PRINTK select SYS_HAS_EARLY_PRINTK
select GPIOLIB select GPIOLIB
select SWAP_IO_SPACE select SWAP_IO_SPACE
@ -516,6 +518,7 @@ config MIPS_MALTA
select SYS_SUPPORTS_MIPS16 select SYS_SUPPORTS_MIPS16
select SYS_SUPPORTS_MULTITHREADING select SYS_SUPPORTS_MULTITHREADING
select SYS_SUPPORTS_SMARTMIPS select SYS_SUPPORTS_SMARTMIPS
select SYS_SUPPORTS_VPE_LOADER
select SYS_SUPPORTS_ZBOOT select SYS_SUPPORTS_ZBOOT
select SYS_SUPPORTS_RELOCATABLE select SYS_SUPPORTS_RELOCATABLE
select USE_OF select USE_OF
@ -2281,9 +2284,16 @@ config MIPSR2_TO_R6_EMULATOR
The only reason this is a build-time option is to save ~14K from the The only reason this is a build-time option is to save ~14K from the
final kernel image. final kernel image.
config SYS_SUPPORTS_VPE_LOADER
bool
depends on SYS_SUPPORTS_MULTITHREADING
help
Indicates that the platform supports the VPE loader, and provides
physical_memsize.
config MIPS_VPE_LOADER config MIPS_VPE_LOADER
bool "VPE loader support." bool "VPE loader support."
depends on SYS_SUPPORTS_MULTITHREADING && MODULES depends on SYS_SUPPORTS_VPE_LOADER && MODULES
select CPU_MIPSR2_IRQ_VI select CPU_MIPSR2_IRQ_VI
select CPU_MIPSR2_IRQ_EI select CPU_MIPSR2_IRQ_EI
select MIPS_MT select MIPS_MT

View file

@ -124,30 +124,36 @@ config SCACHE_DEBUGFS
If unsure, say N. If unsure, say N.
menuconfig MIPS_CPS_NS16550 menuconfig MIPS_CPS_NS16550_BOOL
bool "CPS SMP NS16550 UART output" bool "CPS SMP NS16550 UART output"
depends on MIPS_CPS depends on MIPS_CPS
help help
Output debug information via an ns16550 compatible UART if exceptions Output debug information via an ns16550 compatible UART if exceptions
occur early in the boot process of a secondary core. occur early in the boot process of a secondary core.
if MIPS_CPS_NS16550 if MIPS_CPS_NS16550_BOOL
config MIPS_CPS_NS16550
def_bool MIPS_CPS_NS16550_BASE != 0
config MIPS_CPS_NS16550_BASE config MIPS_CPS_NS16550_BASE
hex "UART Base Address" hex "UART Base Address"
default 0x1b0003f8 if MIPS_MALTA default 0x1b0003f8 if MIPS_MALTA
default 0
help help
The base address of the ns16550 compatible UART on which to output The base address of the ns16550 compatible UART on which to output
debug information from the early stages of core startup. debug information from the early stages of core startup.
This is only used if non-zero.
config MIPS_CPS_NS16550_SHIFT config MIPS_CPS_NS16550_SHIFT
int "UART Register Shift" int "UART Register Shift"
default 0 if MIPS_MALTA default 0
help help
The number of bits to shift ns16550 register indices by in order to The number of bits to shift ns16550 register indices by in order to
form their addresses. That is, log base 2 of the span between form their addresses. That is, log base 2 of the span between
adjacent ns16550 registers in the system. adjacent ns16550 registers in the system.
endif # MIPS_CPS_NS16550 endif # MIPS_CPS_NS16550_BOOL
endmenu endmenu

View file

@ -575,7 +575,7 @@ static int __init ar7_register_uarts(void)
uart_port.type = PORT_AR7; uart_port.type = PORT_AR7;
uart_port.uartclk = clk_get_rate(bus_clk) / 2; uart_port.uartclk = clk_get_rate(bus_clk) / 2;
uart_port.iotype = UPIO_MEM32; uart_port.iotype = UPIO_MEM32;
uart_port.flags = UPF_FIXED_TYPE; uart_port.flags = UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF;
uart_port.regshift = 2; uart_port.regshift = 2;
uart_port.line = 0; uart_port.line = 0;

View file

@ -73,6 +73,7 @@ const char *get_system_type(void)
void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk) void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
{ {
#ifdef CONFIG_SERIAL_8250_CONSOLE
struct uart_port s; struct uart_port s;
memset(&s, 0, sizeof(s)); memset(&s, 0, sizeof(s));
@ -85,6 +86,7 @@ void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
s.uartclk = uartclk; s.uartclk = uartclk;
early_serial_setup(&s); early_serial_setup(&s);
#endif /* CONFIG_SERIAL_8250_CONSOLE */
} }
int __init ath25_add_wmac(int nr, u32 base, int irq) int __init ath25_add_wmac(int nr, u32 base, int irq)

View file

@ -292,7 +292,6 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,
*this_cpu_ptr(&cm_core_lock_flags)); *this_cpu_ptr(&cm_core_lock_flags));
} else { } else {
WARN_ON(cluster != 0); WARN_ON(cluster != 0);
WARN_ON(vp != 0);
WARN_ON(block != CM_GCR_Cx_OTHER_BLOCK_LOCAL); WARN_ON(block != CM_GCR_Cx_OTHER_BLOCK_LOCAL);
/* /*

View file

@ -16,4 +16,5 @@ obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o
obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o
# libgcc-style stuff needed in the kernel # libgcc-style stuff needed in the kernel
obj-y += ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o ucmpdi2.o obj-y += ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o multi3.o \
ucmpdi2.o

View file

@ -10,10 +10,18 @@ typedef int word_type __attribute__ ((mode (__word__)));
struct DWstruct { struct DWstruct {
int high, low; int high, low;
}; };
struct TWstruct {
long long high, low;
};
#elif defined(__LITTLE_ENDIAN) #elif defined(__LITTLE_ENDIAN)
struct DWstruct { struct DWstruct {
int low, high; int low, high;
}; };
struct TWstruct {
long long low, high;
};
#else #else
#error I feel sick. #error I feel sick.
#endif #endif
@ -23,4 +31,13 @@ typedef union {
long long ll; long long ll;
} DWunion; } DWunion;
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6)
typedef int ti_type __attribute__((mode(TI)));
typedef union {
struct TWstruct s;
ti_type ti;
} TWunion;
#endif
#endif /* __ASM_LIBGCC_H */ #endif /* __ASM_LIBGCC_H */

54
arch/mips/lib/multi3.c Normal file
View file

@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/export.h>
#include "libgcc.h"
/*
* GCC 7 suboptimally generates __multi3 calls for mips64r6, so for that
* specific case only we'll implement it here.
*
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981
*/
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ == 7)
/* multiply 64-bit values, low 64-bits returned */
static inline long long notrace dmulu(long long a, long long b)
{
long long res;
asm ("dmulu %0,%1,%2" : "=r" (res) : "r" (a), "r" (b));
return res;
}
/* multiply 64-bit unsigned values, high 64-bits of 128-bit result returned */
static inline long long notrace dmuhu(long long a, long long b)
{
long long res;
asm ("dmuhu %0,%1,%2" : "=r" (res) : "r" (a), "r" (b));
return res;
}
/* multiply 128-bit values, low 128-bits returned */
ti_type notrace __multi3(ti_type a, ti_type b)
{
TWunion res, aa, bb;
aa.ti = a;
bb.ti = b;
/*
* a * b = (a.lo * b.lo)
* + 2^64 * (a.hi * b.lo + a.lo * b.hi)
* [+ 2^128 * (a.hi * b.hi)]
*/
res.s.low = dmulu(aa.s.low, bb.s.low);
res.s.high = dmuhu(aa.s.low, bb.s.low);
res.s.high += dmulu(aa.s.high, bb.s.low);
res.s.high += dmulu(aa.s.low, bb.s.high);
return res.ti;
}
EXPORT_SYMBOL(__multi3);
#endif /* 64BIT && CPU_MIPSR6 && GCC7 */

View file

@ -40,7 +40,7 @@
#include "uasm.c" #include "uasm.c"
static const struct insn const insn_table_MM[insn_invalid] = { static const struct insn insn_table_MM[insn_invalid] = {
[insn_addu] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD}, [insn_addu] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD},
[insn_addiu] = {M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM}, [insn_addiu] = {M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
[insn_and] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD}, [insn_and] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD},

View file

@ -109,9 +109,9 @@ static int rt_timer_probe(struct platform_device *pdev)
} }
rt->irq = platform_get_irq(pdev, 0); rt->irq = platform_get_irq(pdev, 0);
if (!rt->irq) { if (rt->irq < 0) {
dev_err(&pdev->dev, "failed to load irq\n"); dev_err(&pdev->dev, "failed to load irq\n");
return -ENOENT; return rt->irq;
} }
rt->membase = devm_ioremap_resource(&pdev->dev, res); rt->membase = devm_ioremap_resource(&pdev->dev, res);

View file

@ -2,4 +2,6 @@
# Makefile for the RB532 board specific parts of the kernel # Makefile for the RB532 board specific parts of the kernel
# #
obj-y += irq.o time.o setup.o serial.o prom.o gpio.o devices.o obj-$(CONFIG_SERIAL_8250_CONSOLE) += serial.o
obj-y += irq.o time.o setup.o prom.o gpio.o devices.o

View file

@ -310,6 +310,8 @@ static int __init plat_setup_devices(void)
return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
} }
#ifdef CONFIG_NET
static int __init setup_kmac(char *s) static int __init setup_kmac(char *s)
{ {
printk(KERN_INFO "korina mac = %s\n", s); printk(KERN_INFO "korina mac = %s\n", s);
@ -322,4 +324,6 @@ static int __init setup_kmac(char *s)
__setup("kmac=", setup_kmac); __setup("kmac=", setup_kmac);
#endif /* CONFIG_NET */
arch_initcall(plat_setup_devices); arch_initcall(plat_setup_devices);