Commit 6917b51d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'cris-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris

Pull CRIS updates from Jesper Nilsson:
 "Mostly removal of old cruft of which we can use a generic version, or
  fixes for code not commonly run in the cris port, but also additions
  to enable some good debug"

* tag 'cris-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris: (25 commits)
  CRISv10: delete unused lib/dmacopy.c
  CRISv10: delete unused lib/old_checksum.c
  CRIS: fix switch_mm() lockdep splat
  CRISv32: enable LOCKDEP_SUPPORT
  CRIS: add STACKTRACE_SUPPORT
  CRISv32: annotate irq enable in idle loop
  CRISv32: add support for irqflags tracing
  CRIS: UAPI: use generic types.h
  CRIS: UAPI: use generic shmbuf.h
  CRIS: UAPI: use generic msgbuf.h
  CRIS: UAPI: use generic socket.h
  CRIS: UAPI: use generic sembuf.h
  CRIS: UAPI: use generic sockios.h
  CRIS: UAPI: use generic auxvec.h
  CRIS: UAPI: use generic headers via Kbuild
  CRIS: UAPI: fix elf.h export
  CRIS: don't make asm/elf.h depend on asm/user.h
  CRIS: UAPI: fix ptrace.h
  CRISv32: Squash compile warnings for axisflashmap
  CRISv32: Add GPIO driver to the default configs
  ...
parents 10fbd36e 254a0f41
...@@ -36,6 +36,17 @@ config FORCE_MAX_ZONEORDER ...@@ -36,6 +36,17 @@ config FORCE_MAX_ZONEORDER
int int
default 6 default 6
config TRACE_IRQFLAGS_SUPPORT
depends on ETRAX_ARCH_V32
def_bool y
config STACKTRACE_SUPPORT
def_bool y
config LOCKDEP_SUPPORT
depends on ETRAX_ARCH_V32
def_bool y
config CRIS config CRIS
bool bool
default y default y
...@@ -58,6 +69,7 @@ config CRIS ...@@ -58,6 +69,7 @@ config CRIS
select CLKSRC_MMIO if ETRAX_ARCH_V32 select CLKSRC_MMIO if ETRAX_ARCH_V32
select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32 select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32
select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32 select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32
select HAVE_DEBUG_BUGVERBOSE if ETRAX_ARCH_V32
config HZ config HZ
int int
......
...@@ -955,6 +955,14 @@ sys_call_table: ...@@ -955,6 +955,14 @@ sys_call_table:
.long sys_process_vm_writev .long sys_process_vm_writev
.long sys_kcmp /* 350 */ .long sys_kcmp /* 350 */
.long sys_finit_module .long sys_finit_module
.long sys_sched_setattr
.long sys_sched_getattr
.long sys_renameat2
.long sys_seccomp /* 355 */
.long sys_getrandom
.long sys_memfd_create
.long sys_bpf
.long sys_execveat
/* /*
* NOTE!! This doesn't have to be exact - we just have * NOTE!! This doesn't have to be exact - we just have
......
/*
* memcpy for large blocks, using memory-memory DMA channels 6 and 7 in Etrax
*/
#include <asm/svinto.h>
#include <asm/io.h>
#define D(x)
void *dma_memcpy(void *pdst,
const void *psrc,
unsigned int pn)
{
static etrax_dma_descr indma, outdma;
D(printk(KERN_DEBUG "dma_memcpy %d bytes... ", pn));
#if 0
*R_GEN_CONFIG = genconfig_shadow =
(genconfig_shadow & ~0x3c0000) |
IO_STATE(R_GEN_CONFIG, dma6, intdma7) |
IO_STATE(R_GEN_CONFIG, dma7, intdma6);
#endif
indma.sw_len = outdma.sw_len = pn;
indma.ctrl = d_eol | d_eop;
outdma.ctrl = d_eol;
indma.buf = psrc;
outdma.buf = pdst;
*R_DMA_CH6_FIRST = &indma;
*R_DMA_CH7_FIRST = &outdma;
*R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, start);
*R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, start);
while (*R_DMA_CH7_CMD == 1)
/* wait for completion */;
D(printk(KERN_DEBUG "done\n"));
}
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* IP/TCP/UDP checksumming routines
*
* Authors: Jorge Cwik, <jorge@laser.satlink.net>
* Arnt Gulbrandsen, <agulbra@nvg.unit.no>
* Tom May, <ftom@netcom.com>
* Lots of code moved from tcp.c and ip.c; see those files
* for more names.
*
* 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 <net/checksum.h>
#include <net/module.h>
#undef PROFILE_CHECKSUM
#ifdef PROFILE_CHECKSUM
/* these are just for profiling the checksum code with an oscillioscope.. uh */
#if 0
#define BITOFF *((unsigned char *)0xb0000030) = 0xff
#define BITON *((unsigned char *)0xb0000030) = 0x0
#endif
#include <asm/io.h>
#define CBITON LED_ACTIVE_SET(1)
#define CBITOFF LED_ACTIVE_SET(0)
#define BITOFF
#define BITON
#else
#define BITOFF
#define BITON
#define CBITOFF
#define CBITON
#endif
/*
* computes a partial checksum, e.g. for TCP/UDP fragments
*/
#include <asm/delay.h>
__wsum csum_partial(const void *p, int len, __wsum __sum)
{
u32 sum = (__force u32)__sum;
const u16 *buff = p;
/*
* Experiments with ethernet and slip connections show that buff
* is aligned on either a 2-byte or 4-byte boundary.
*/
const void *endMarker = p + len;
const void *marker = endMarker - (len % 16);
#if 0
if((int)buff & 0x3)
printk("unaligned buff %p\n", buff);
__delay(900); /* extra delay of 90 us to test performance hit */
#endif
BITON;
while (buff < marker) {
sum += *buff++;
sum += *buff++;
sum += *buff++;
sum += *buff++;
sum += *buff++;
sum += *buff++;
sum += *buff++;
sum += *buff++;
}
marker = endMarker - (len % 2);
while (buff < marker)
sum += *buff++;
if (endMarker > buff)
sum += *(const u8 *)buff; /* add extra byte separately */
BITOFF;
return (__force __wsum)sum;
}
EXPORT_SYMBOL(csum_partial);
...@@ -202,7 +202,7 @@ config ETRAX_PA_CHANGEABLE_DIR ...@@ -202,7 +202,7 @@ config ETRAX_PA_CHANGEABLE_DIR
default "0x00" if ETRAXFS default "0x00" if ETRAXFS
default "0x00000000" if !ETRAXFS default "0x00000000" if !ETRAXFS
help help
This is a bitmask (8 bits) with information of what bits in PA that a This is a bitmask with information of what bits in PA that a
user can change direction on using ioctl's. user can change direction on using ioctl's.
Bit set = changeable. Bit set = changeable.
You probably want 0 here, but it depends on your hardware. You probably want 0 here, but it depends on your hardware.
...@@ -213,7 +213,7 @@ config ETRAX_PA_CHANGEABLE_BITS ...@@ -213,7 +213,7 @@ config ETRAX_PA_CHANGEABLE_BITS
default "0x00" if ETRAXFS default "0x00" if ETRAXFS
default "0x00000000" if !ETRAXFS default "0x00000000" if !ETRAXFS
help help
This is a bitmask (8 bits) with information of what bits in PA This is a bitmask with information of what bits in PA
that a user can change the value on using ioctl's. that a user can change the value on using ioctl's.
Bit set = changeable. Bit set = changeable.
...@@ -223,7 +223,7 @@ config ETRAX_PB_CHANGEABLE_DIR ...@@ -223,7 +223,7 @@ config ETRAX_PB_CHANGEABLE_DIR
default "0x00000" if ETRAXFS default "0x00000" if ETRAXFS
default "0x00000000" if !ETRAXFS default "0x00000000" if !ETRAXFS
help help
This is a bitmask (18 bits) with information of what bits in PB This is a bitmask with information of what bits in PB
that a user can change direction on using ioctl's. that a user can change direction on using ioctl's.
Bit set = changeable. Bit set = changeable.
You probably want 0 here, but it depends on your hardware. You probably want 0 here, but it depends on your hardware.
...@@ -234,7 +234,7 @@ config ETRAX_PB_CHANGEABLE_BITS ...@@ -234,7 +234,7 @@ config ETRAX_PB_CHANGEABLE_BITS
default "0x00000" if ETRAXFS default "0x00000" if ETRAXFS
default "0x00000000" if !ETRAXFS default "0x00000000" if !ETRAXFS
help help
This is a bitmask (18 bits) with information of what bits in PB This is a bitmask with information of what bits in PB
that a user can change the value on using ioctl's. that a user can change the value on using ioctl's.
Bit set = changeable. Bit set = changeable.
...@@ -244,7 +244,7 @@ config ETRAX_PC_CHANGEABLE_DIR ...@@ -244,7 +244,7 @@ config ETRAX_PC_CHANGEABLE_DIR
default "0x00000" if ETRAXFS default "0x00000" if ETRAXFS
default "0x00000000" if !ETRAXFS default "0x00000000" if !ETRAXFS
help help
This is a bitmask (18 bits) with information of what bits in PC This is a bitmask with information of what bits in PC
that a user can change direction on using ioctl's. that a user can change direction on using ioctl's.
Bit set = changeable. Bit set = changeable.
You probably want 0 here, but it depends on your hardware. You probably want 0 here, but it depends on your hardware.
...@@ -253,9 +253,9 @@ config ETRAX_PC_CHANGEABLE_BITS ...@@ -253,9 +253,9 @@ config ETRAX_PC_CHANGEABLE_BITS
hex "PC user changeable bits mask" hex "PC user changeable bits mask"
depends on ETRAX_GPIO depends on ETRAX_GPIO
default "0x00000" if ETRAXFS default "0x00000" if ETRAXFS
default "0x00000000" if ETRAXFS default "0x00000000" if !ETRAXFS
help help
This is a bitmask (18 bits) with information of what bits in PC This is a bitmask with information of what bits in PC
that a user can change the value on using ioctl's. that a user can change the value on using ioctl's.
Bit set = changeable. Bit set = changeable.
...@@ -264,7 +264,7 @@ config ETRAX_PD_CHANGEABLE_DIR ...@@ -264,7 +264,7 @@ config ETRAX_PD_CHANGEABLE_DIR
depends on ETRAX_GPIO && ETRAXFS depends on ETRAX_GPIO && ETRAXFS
default "0x00000" default "0x00000"
help help
This is a bitmask (18 bits) with information of what bits in PD This is a bitmask with information of what bits in PD
that a user can change direction on using ioctl's. that a user can change direction on using ioctl's.
Bit set = changeable. Bit set = changeable.
You probably want 0x00000 here, but it depends on your hardware. You probably want 0x00000 here, but it depends on your hardware.
......
...@@ -313,6 +313,7 @@ static int __init init_axis_flash(void) ...@@ -313,6 +313,7 @@ static int __init init_axis_flash(void)
size_t len; size_t len;
int ram_rootfs_partition = -1; /* -1 => no RAM rootfs partition */ int ram_rootfs_partition = -1; /* -1 => no RAM rootfs partition */
int part; int part;
struct mtd_partition *partition;
/* We need a root fs. If it resides in RAM, we need to use an /* We need a root fs. If it resides in RAM, we need to use an
* MTDRAM device, so it must be enabled in the kernel config, * MTDRAM device, so it must be enabled in the kernel config,
...@@ -329,7 +330,7 @@ static int __init init_axis_flash(void) ...@@ -329,7 +330,7 @@ static int __init init_axis_flash(void)
main_mtd = flash_probe(); main_mtd = flash_probe();
if (main_mtd) if (main_mtd)
printk(KERN_INFO "%s: 0x%08x bytes of NOR flash memory.\n", printk(KERN_INFO "%s: 0x%08llx bytes of NOR flash memory.\n",
main_mtd->name, main_mtd->size); main_mtd->name, main_mtd->size);
#ifdef CONFIG_ETRAX_NANDFLASH #ifdef CONFIG_ETRAX_NANDFLASH
...@@ -388,10 +389,10 @@ static int __init init_axis_flash(void) ...@@ -388,10 +389,10 @@ static int __init init_axis_flash(void)
#endif #endif
if (main_mtd) { if (main_mtd) {
loff_t ptable_sector = CONFIG_ETRAX_PTABLE_SECTOR;
main_mtd->owner = THIS_MODULE; main_mtd->owner = THIS_MODULE;
axisflash_mtd = main_mtd; axisflash_mtd = main_mtd;
loff_t ptable_sector = CONFIG_ETRAX_PTABLE_SECTOR;
/* First partition (rescue) is always set to the default. */ /* First partition (rescue) is always set to the default. */
pidx++; pidx++;
...@@ -517,7 +518,7 @@ static int __init init_axis_flash(void) ...@@ -517,7 +518,7 @@ static int __init init_axis_flash(void)
/* Decide whether to use default partition table. */ /* Decide whether to use default partition table. */
/* Only use default table if we actually have a device (main_mtd) */ /* Only use default table if we actually have a device (main_mtd) */
struct mtd_partition *partition = &axis_partitions[0]; partition = &axis_partitions[0];
if (main_mtd && !ptable_ok) { if (main_mtd && !ptable_ok) {
memcpy(axis_partitions, axis_default_partitions, memcpy(axis_partitions, axis_default_partitions,
sizeof(axis_default_partitions)); sizeof(axis_default_partitions));
...@@ -580,7 +581,7 @@ static int __init init_axis_flash(void) ...@@ -580,7 +581,7 @@ static int __init init_axis_flash(void)
printk(KERN_INFO "axisflashmap: Adding RAM partition " printk(KERN_INFO "axisflashmap: Adding RAM partition "
"for rootfs image.\n"); "for rootfs image.\n");
err = mtdram_init_device(mtd_ram, err = mtdram_init_device(mtd_ram,
(void *)partition[part].offset, (void *)(u_int32_t)partition[part].offset,
partition[part].size, partition[part].size,
partition[part].name); partition[part].name);
if (err) if (err)
......
...@@ -957,7 +957,7 @@ static void __init virtual_gpio_init(void) ...@@ -957,7 +957,7 @@ static void __init virtual_gpio_init(void)
static int __init gpio_init(void) static int __init gpio_init(void)
{ {
int res; int res, res2;
printk(KERN_INFO "ETRAX FS GPIO driver v2.7, (c) 2003-2008 " printk(KERN_INFO "ETRAX FS GPIO driver v2.7, (c) 2003-2008 "
"Axis Communications AB\n"); "Axis Communications AB\n");
...@@ -977,7 +977,7 @@ static int __init gpio_init(void) ...@@ -977,7 +977,7 @@ static int __init gpio_init(void)
CRIS_LED_DISK_READ(0); CRIS_LED_DISK_READ(0);
CRIS_LED_DISK_WRITE(0); CRIS_LED_DISK_WRITE(0);
int res2 = request_irq(GIO_INTR_VECT, gpio_interrupt, res2 = request_irq(GIO_INTR_VECT, gpio_interrupt,
IRQF_SHARED, "gpio", &alarmlist); IRQF_SHARED, "gpio", &alarmlist);
if (res2) { if (res2) {
printk(KERN_ERR "err: irq for gpio\n"); printk(KERN_ERR "err: irq for gpio\n");
......
...@@ -425,12 +425,11 @@ gpio_open(struct inode *inode, struct file *filp) ...@@ -425,12 +425,11 @@ gpio_open(struct inode *inode, struct file *filp)
if (p > GPIO_MINOR_LAST) if (p > GPIO_MINOR_LAST)
return -EINVAL; return -EINVAL;
priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL); priv = kzalloc(sizeof(struct gpio_private), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
mutex_lock(&gpio_mutex); mutex_lock(&gpio_mutex);
memset(priv, 0, sizeof(*priv));
priv->minor = p; priv->minor = p;
......
...@@ -240,6 +240,17 @@ ret_from_sys_call: ...@@ -240,6 +240,17 @@ ret_from_sys_call:
.type _Rexit,@function .type _Rexit,@function
_Rexit: _Rexit:
#if defined(CONFIG_TRACE_IRQFLAGS)
addoq +PT_ccs, $sp, $acr
move.d [$acr], $r0
btstq 15, $r0 ; I1
bpl 1f
nop
jsr trace_hardirqs_on
nop
1:
#endif
;; This epilogue MUST match the prologues in multiple_interrupt, irq.h ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h
;; and ptregs.h. ;; and ptregs.h.
addq 4, $sp ; Skip orig_r10. addq 4, $sp ; Skip orig_r10.
...@@ -875,6 +886,14 @@ sys_call_table: ...@@ -875,6 +886,14 @@ sys_call_table:
.long sys_process_vm_writev .long sys_process_vm_writev
.long sys_kcmp /* 350 */ .long sys_kcmp /* 350 */
.long sys_finit_module .long sys_finit_module
.long sys_sched_setattr
.long sys_sched_getattr
.long sys_renameat2
.long sys_seccomp /* 355 */
.long sys_getrandom
.long sys_memfd_create
.long sys_bpf
.long sys_execveat
/* /*
* NOTE!! This doesn't have to be exact - we just have * NOTE!! This doesn't have to be exact - we just have
......
...@@ -23,9 +23,9 @@ extern void stop_watchdog(void); ...@@ -23,9 +23,9 @@ extern void stop_watchdog(void);
/* We use this if we don't have any better idle routine. */ /* We use this if we don't have any better idle routine. */
void default_idle(void) void default_idle(void)
{ {
local_irq_enable();
/* Halt until exception. */ /* Halt until exception. */
__asm__ volatile("ei \n\t" __asm__ volatile("halt");
"halt ");
} }
/* /*
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/ucontext.h> #include <asm/ucontext.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <arch/ptrace.h>
#include <arch/hwregs/cpu_vect.h> #include <arch/hwregs/cpu_vect.h>
extern unsigned long cris_signal_return_page; extern unsigned long cris_signal_return_page;
......
...@@ -46,6 +46,8 @@ static int __crisv32_pinmux_alloc(int port, int first_pin, int last_pin, ...@@ -46,6 +46,8 @@ static int __crisv32_pinmux_alloc(int port, int first_pin, int last_pin,
pins[port][i] = mode; pins[port][i] = mode;
crisv32_pinmux_set(port); crisv32_pinmux_set(port);
return 0;
} }
static int crisv32_pinmux_init(void) static int crisv32_pinmux_init(void)
...@@ -93,6 +95,7 @@ int crisv32_pinmux_alloc_fixed(enum fixed_function function) ...@@ -93,6 +95,7 @@ int crisv32_pinmux_alloc_fixed(enum fixed_function function)
int ret = -EINVAL; int ret = -EINVAL;
char saved[sizeof pins]; char saved[sizeof pins];
unsigned long flags; unsigned long flags;
reg_pinmux_rw_hwprot hwprot;
spin_lock_irqsave(&pinmux_lock, flags); spin_lock_irqsave(&pinmux_lock, flags);
...@@ -101,7 +104,7 @@ int crisv32_pinmux_alloc_fixed(enum fixed_function function) ...@@ -101,7 +104,7 @@ int crisv32_pinmux_alloc_fixed(enum fixed_function function)
crisv32_pinmux_init(); /* Must be done before we read rw_hwprot */ crisv32_pinmux_init(); /* Must be done before we read rw_hwprot */
reg_pinmux_rw_hwprot hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot); hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
switch (function) { switch (function) {
case pinmux_ser1: case pinmux_ser1:
...@@ -227,6 +230,7 @@ int crisv32_pinmux_dealloc_fixed(enum fixed_function function) ...@@ -227,6 +230,7 @@ int crisv32_pinmux_dealloc_fixed(enum fixed_function function)
int ret = -EINVAL; int ret = -EINVAL;
char saved[sizeof pins]; char saved[sizeof pins];
unsigned long flags; unsigned long flags;
reg_pinmux_rw_hwprot hwprot;
spin_lock_irqsave(&pinmux_lock, flags); spin_lock_irqsave(&pinmux_lock, flags);
...@@ -235,7 +239,7 @@ int crisv32_pinmux_dealloc_fixed(enum fixed_function function) ...@@ -235,7 +239,7 @@ int crisv32_pinmux_dealloc_fixed(enum fixed_function function)
crisv32_pinmux_init(); /* Must be done before we read rw_hwprot */ crisv32_pinmux_init(); /* Must be done before we read rw_hwprot */
reg_pinmux_rw_hwprot hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot); hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
switch (function) { switch (function) {
case pinmux_ser1: case pinmux_ser1:
......
...@@ -12,10 +12,6 @@ CONFIG_ETRAX_FAST_TIMER=y ...@@ -12,10 +12,6 @@ CONFIG_ETRAX_FAST_TIMER=y
CONFIG_CRIS_MACH_ARTPEC3=y CONFIG_CRIS_MACH_ARTPEC3=y
CONFIG_ETRAX_DRAM_SIZE=32 CONFIG_ETRAX_DRAM_SIZE=32
CONFIG_ETRAX_FLASH1_SIZE=4 CONFIG_ETRAX_FLASH1_SIZE=4
CONFIG_ETRAX_DEF_GIO_PA_OE=1c
CONFIG_ETRAX_DEF_GIO_PA_OUT=00
CONFIG_ETRAX_DEF_GIO_PB_OE=00000
CONFIG_ETRAX_DEF_GIO_PB_OUT=00000
CONFIG_NET=y CONFIG_NET=y
CONFIG_PACKET=y CONFIG_PACKET=y
CONFIG_UNIX=y CONFIG_UNIX=y
...@@ -42,3 +38,4 @@ CONFIG_JFFS2_FS=y ...@@ -42,3 +38,4 @@ CONFIG_JFFS2_FS=y
CONFIG_CRAMFS=y CONFIG_CRAMFS=y
CONFIG_NFS_FS=y CONFIG_NFS_FS=y
CONFIG_NFS_V3=y CONFIG_NFS_V3=y
CONFIG_ETRAX_GPIO=y
...@@ -38,3 +38,4 @@ CONFIG_JFFS2_FS=y ...@@ -38,3 +38,4 @@ CONFIG_JFFS2_FS=y
CONFIG_CRAMFS=y CONFIG_CRAMFS=y
CONFIG_NFS_FS=y CONFIG_NFS_FS=y
CONFIG_NFS_V3=y CONFIG_NFS_V3=y
CONFIG_ETRAX_GPIO=y
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* All other stuff is done out-of-band with exception handlers. * All other stuff is done out-of-band with exception handlers.
*/ */
#define BUG() \ #define BUG() \
do { \
__asm__ __volatile__ ("0: break 14\n\t" \ __asm__ __volatile__ ("0: break 14\n\t" \
".section .fixup,\"ax\"\n" \ ".section .fixup,\"ax\"\n" \
"1:\n\t" \ "1:\n\t" \
...@@ -21,9 +22,15 @@ ...@@ -21,9 +22,15 @@
".section __ex_table,\"a\"\n\t" \ ".section __ex_table,\"a\"\n\t" \
".dword 0b, 1b\n\t" \ ".dword 0b, 1b\n\t" \
".previous\n\t" \ ".previous\n\t" \
: : "ri" (__FILE__), "i" (__LINE__)) : : "ri" (__FILE__), "i" (__LINE__)); \
unreachable(); \
} while (0)
#else #else
#define BUG() __asm__ __volatile__ ("break 14\n\t") #define BUG() \
do { \
__asm__ __volatile__ ("break 14\n\t"); \
unreachable(); \
} while (0)
#endif #endif
#define HAVE_ARCH_BUG #define HAVE_ARCH_BUG
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define __ASM_CRIS_ARCH_IRQFLAGS_H #define __ASM_CRIS_ARCH_IRQFLAGS_H
#include <linux/types.h> #include <linux/types.h>
#include <arch/ptrace.h> #include <asm/ptrace.h>
static inline unsigned long arch_local_save_flags(void) static inline unsigned long arch_local_save_flags(void)
{ {
......
generic-y += atomic.h generic-y += atomic.h
generic-y += auxvec.h
generic-y += barrier.h generic-y += barrier.h
generic-y += bitsperlong.h
generic-y += clkdev.h generic-y += clkdev.h
generic-y += cmpxchg.h generic-y += cmpxchg.h
generic-y += cputime.h generic-y += cputime.h
generic-y += device.h generic-y += device.h
generic-y += div64.h generic-y += div64.h
generic-y += errno.h
generic-y += exec.h generic-y += exec.h
generic-y += emergency-restart.h generic-y += emergency-restart.h
generic-y += fcntl.h
generic-y += futex.h generic-y += futex.h
generic-y += hardirq.h generic-y += hardirq.h
generic-y += ioctl.h
generic-y += ipcbuf.h
generic-y += irq_regs.h generic-y += irq_regs.h
generic-y += irq_work.h generic-y += irq_work.h
generic-y += kdebug.h generic-y += kdebug.h
...@@ -19,11 +25,22 @@ generic-y += local.h ...@@ -19,11 +25,22 @@ generic-y += local.h
generic-y += local64.h generic-y += local64.h
generic-y += mcs_spinlock.h generic-y += mcs_spinlock.h
generic-y += mm-arch-hooks.h generic-y += mm-arch-hooks.h
generic-y += mman.h
generic-y += module.h generic-y += module.h
generic-y += msgbuf.h
generic-y += percpu.h generic-y += percpu.h
generic-y += poll.h
generic-y += preempt.h generic-y += preempt.h
generic-y += resource.h
generic-y += sections.h generic-y += sections.h
generic-y += sembuf.h
generic-y += shmbuf.h
generic-y += siginfo.h
generic-y += socket.h
generic-y += sockios.h
generic-y += statfs.h
generic-y += topology.h generic-y += topology.h
generic-y += trace_clock.h generic-y += trace_clock.h
generic-y += types.h
generic-y += vga.h generic-y += vga.h
generic-y += xor.h generic-y += xor.h
...@@ -11,7 +11,14 @@ extern void switch_mm(struct mm_struct *prev, struct mm_struct *next, ...@@ -11,7 +11,14 @@ extern void switch_mm(struct mm_struct *prev, struct mm_struct *next,
#define deactivate_mm(tsk,mm) do { } while (0) #define deactivate_mm(tsk,mm) do { } while (0)
#define activate_mm(prev,next) switch_mm((prev),(next),NULL) static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
{
unsigned long flags;
local_irq_save(flags);
switch_mm(prev, next, NULL);
local_irq_restore(flags);
}
/* current active pgd - this is similar to other processors pgd /* current active pgd - this is similar to other processors pgd
* registers like cr3 on the i386 * registers like cr3 on the i386
......
#ifndef __CRIS_STACKTRACE_H
#define __CRIS_STACKTRACE_H
void walk_stackframe(unsigned long sp,
int (*fn)(unsigned long addr, void *data),
void *data);
#endif
#ifndef _ETRAX_TYPES_H
#define _ETRAX_TYPES_H
#include <uapi/asm/types.h>
/*
* These aren't exported outside the kernel to avoid name space clashes
*/
#define BITS_PER_LONG 32
#endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <uapi/asm/unistd.h> #include <uapi/asm/unistd.h>
#define NR_syscalls 360 #define NR_syscalls 365
#include <arch/unistd.h> #include <arch/unistd.h>
......
...@@ -6,6 +6,9 @@ header-y += ../arch-v32/arch/ ...@@ -6,6 +6,9 @@ header-y += ../arch-v32/arch/
header-y += auxvec.h header-y += auxvec.h
header-y += bitsperlong.h header-y += bitsperlong.h
header-y += byteorder.h header-y += byteorder.h
header-y += elf.h
header-y += elf_v10.h
header-y += elf_v32.h
header-y += errno.h header-y += errno.h
header-y += ethernet.h header-y += ethernet.h
header-y += etraxgpio.h header-y += etraxgpio.h
...@@ -19,6 +22,8 @@ header-y += param.h ...@@ -19,6 +22,8 @@ header-y += param.h
header-y += poll.h header-y += poll.h
header-y += posix_types.h header-y += posix_types.h
header-y += ptrace.h header-y += ptrace.h
header-y += ptrace_v10.h
header-y += ptrace_v32.h
header-y += resource.h header-y += resource.h
header-y += rs485.h header-y += rs485.h
header-y += sembuf.h header-y += sembuf.h
......
#ifndef __ASMCRIS_AUXVEC_H
#define __ASMCRIS_AUXVEC_H
#endif
#include <asm-generic/bitsperlong.h>
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
* ELF register definitions.. * ELF register definitions..
*/ */
#include <asm/user.h> #ifdef __arch_v32
#include <asm/elf_v32.h>
#else
#include <asm/elf_v10.h>
#endif
#define R_CRIS_NONE 0 #define R_CRIS_NONE 0
#define R_CRIS_8 1 #define R_CRIS_8 1
...@@ -32,7 +36,6 @@ typedef unsigned long elf_greg_t; ...@@ -32,7 +36,6 @@ typedef unsigned long elf_greg_t;
/* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is /* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
thus exposed to user-space. */ thus exposed to user-space. */
#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef elf_greg_t elf_gregset_t[ELF_NGREG];
/* A placeholder; CRIS does not have any fp regs. */ /* A placeholder; CRIS does not have any fp regs. */
...@@ -45,8 +48,6 @@ typedef unsigned long elf_fpregset_t; ...@@ -45,8 +48,6 @@ typedef unsigned long elf_fpregset_t;
#define ELF_DATA ELFDATA2LSB #define ELF_DATA ELFDATA2LSB
#define ELF_ARCH EM_CRIS #define ELF_ARCH EM_CRIS
#include <arch/elf.h>
/* The master for these definitions is {binutils}/include/elf/cris.h: */ /* The master for these definitions is {binutils}/include/elf/cris.h: */
/* User symbols in this file have a leading underscore. */ /* User symbols in this file have a leading underscore. */
#define EF_CRIS_UNDERSCORE 0x00000001 #define EF_CRIS_UNDERSCORE 0x00000001
......
#ifndef __ASMCRIS_ARCH_ELF_H #ifndef __ASMCRIS_ARCH_ELF_H
#define __ASMCRIS_ARCH_ELF_H #define __ASMCRIS_ARCH_ELF_H
#include <arch/system.h>
#define ELF_MACH EF_CRIS_VARIANT_ANY_V0_V10 #define ELF_MACH EF_CRIS_VARIANT_ANY_V0_V10
/* Matches struct user_regs_struct */
#define ELF_NGREG 35
/* /*
* This is used to ensure we don't load something for the wrong architecture. * This is used to ensure we don't load something for the wrong architecture.
*/ */
......
#ifndef _ASM_CRIS_ELF_H #ifndef _ASM_CRIS_ELF_H
#define _ASM_CRIS_ELF_H #define _ASM_CRIS_ELF_H
#include <arch/system.h>
#define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32 #define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32
/* Matches struct user_regs_struct */
#define ELF_NGREG 32
/* /*
* This is used to ensure we don't load something for the wrong architecture. * This is used to ensure we don't load something for the wrong architecture.
*/ */
......
#ifndef _CRIS_ERRNO_H
#define _CRIS_ERRNO_H
#include <asm-generic/errno.h>
#endif
#include <asm-generic/fcntl.h>
#include <asm-generic/ioctl.h>
#include <asm-generic/ipcbuf.h>
#include <asm-generic/kvm_para.h>
#include <asm-generic/mman.h>
#ifndef _CRIS_MSGBUF_H
#define _CRIS_MSGBUF_H
/* verbatim copy of asm-i386 version */
/*
* The msqid64_ds structure for CRIS architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* Pad space is left for:
* - 64-bit time_t to solve y2038 problem
* - 2 miscellaneous 32-bit values
*/
struct msqid64_ds {
struct ipc64_perm msg_perm;
__kernel_time_t msg_stime; /* last msgsnd time */
unsigned long __unused1;
__kernel_time_t msg_rtime; /* last msgrcv time */
unsigned long __unused2;
__kernel_time_t msg_ctime; /* last change time */
unsigned long __unused3;
unsigned long msg_cbytes; /* current number of bytes on queue */
unsigned long msg_qnum; /* number of messages in queue */
unsigned long msg_qbytes; /* max number of bytes on queue */
__kernel_pid_t msg_lspid; /* pid of last msgsnd */
__kernel_pid_t msg_lrpid; /* last receive pid */
unsigned long __unused4;
unsigned long __unused5;
};
#endif /* _CRIS_MSGBUF_H */
#include <asm-generic/poll.h>
#include <arch/ptrace.h> #ifdef __arch_v32
#include <asm/ptrace_v32.h>
#else
#include <asm/ptrace_v10.h>
#endif
#ifndef _CRIS_RESOURCE_H
#define _CRIS_RESOURCE_H
#include <asm-generic/resource.h>
#endif
#ifndef _CRIS_SEMBUF_H
#define _CRIS_SEMBUF_H
/*
* The semid64_ds structure for CRIS architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* Pad space is left for:
* - 64-bit time_t to solve y2038 problem
* - 2 miscellaneous 32-bit values
*/
struct semid64_ds {
struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
__kernel_time_t sem_otime; /* last semop time */
unsigned long __unused1;
__kernel_time_t sem_ctime; /* last change time */
unsigned long __unused2;
unsigned long sem_nsems; /* no. of semaphores in array */
unsigned long __unused3;
unsigned long __unused4;
};
#endif /* _CRIS_SEMBUF_H */
#ifndef _CRIS_SHMBUF_H
#define _CRIS_SHMBUF_H
/*
* The shmid64_ds structure for CRIS architecture (same as for i386)
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*
* Pad space is left for:
* - 64-bit time_t to solve y2038 problem
* - 2 miscellaneous 32-bit values
*/
struct shmid64_ds {
struct ipc64_perm shm_perm; /* operation perms */
size_t shm_segsz; /* size of segment (bytes) */
__kernel_time_t shm_atime; /* last attach time */
unsigned long __unused1;
__kernel_time_t shm_dtime; /* last detach time */
unsigned long __unused2;
__kernel_time_t shm_ctime; /* last change time */
unsigned long __unused3;
__kernel_pid_t shm_cpid; /* pid of creator */
__kernel_pid_t shm_lpid; /* pid of last operator */
unsigned long shm_nattch; /* no. of current attaches */
unsigned long __unused4;
unsigned long __unused5;
};
struct shminfo64 {
unsigned long shmmax;
unsigned long shmmin;
unsigned long shmmni;
unsigned long shmseg;
unsigned long shmall;
unsigned long __unused1;
unsigned long __unused2;
unsigned long __unused3;
unsigned long __unused4;
};
#endif /* _CRIS_SHMBUF_H */
#ifndef _CRIS_SIGINFO_H
#define _CRIS_SIGINFO_H
#include <asm-generic/siginfo.h>
#endif
#ifndef _ASM_SOCKET_H
#define _ASM_SOCKET_H
/* almost the same as asm-i386/socket.h */
#include <asm/sockios.h>
/* For setsockoptions(2) */
#define SOL_SOCKET 1
#define SO_DEBUG 1
#define SO_REUSEADDR 2
#define SO_TYPE 3
#define SO_ERROR 4
#define SO_DONTROUTE 5
#define SO_BROADCAST 6
#define SO_SNDBUF 7
#define SO_RCVBUF 8
#define SO_SNDBUFFORCE 32
#define SO_RCVBUFFORCE 33
#define SO_KEEPALIVE 9
#define SO_OOBINLINE 10
#define SO_NO_CHECK 11
#define SO_PRIORITY 12
#define SO_LINGER 13
#define SO_BSDCOMPAT 14
#define SO_REUSEPORT 15
#define SO_PASSCRED 16
#define SO_PEERCRED 17
#define SO_RCVLOWAT 18
#define SO_SNDLOWAT 19
#define SO_RCVTIMEO 20
#define SO_SNDTIMEO 21
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define SO_SECURITY_ENCRYPTION_NETWORK 24
#define SO_BINDTODEVICE 25
/* Socket filtering */
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
#define SO_GET_FILTER SO_ATTACH_FILTER
#define SO_PEERNAME 28
#define SO_TIMESTAMP 29
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
#define SO_PASSSEC 34
#define SO_TIMESTAMPNS 35
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
#define SO_MARK 36
#define SO_TIMESTAMPING 37
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_PROTOCOL 38
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS
#define SO_PEEK_OFF 42
/* Instruct lower device to use last 4-bytes of skb data as FCS */
#define SO_NOFCS 43
#define SO_LOCK_FILTER 44
#define SO_SELECT_ERR_QUEUE 45
#define SO_BUSY_POLL 46
#define SO_MAX_PACING_RATE 47
#define SO_BPF_EXTENSIONS 48
#define SO_INCOMING_CPU 49
#define SO_ATTACH_BPF 50
#define SO_DETACH_BPF SO_DETACH_FILTER
#endif /* _ASM_SOCKET_H */
#ifndef __ARCH_CRIS_SOCKIOS__
#define __ARCH_CRIS_SOCKIOS__
/* Socket-level I/O control calls. */
#define FIOSETOWN 0x8901
#define SIOCSPGRP 0x8902
#define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif
#ifndef _CRIS_STATFS_H
#define _CRIS_STATFS_H
#include <asm-generic/statfs.h>
#endif
#include <asm-generic/int-ll64.h>
...@@ -356,5 +356,13 @@ ...@@ -356,5 +356,13 @@
#define __NR_process_vm_writev 349 #define __NR_process_vm_writev 349
#define __NR_kcmp 350 #define __NR_kcmp 350
#define __NR_finit_module 351 #define __NR_finit_module 351
#define __NR_sched_setattr 352
#define __NR_sched_getattr 353
#define __NR_renameat2 354
#define __NR_seccomp 355
#define __NR_getrandom 356
#define __NR_memfd_create 357
#define __NR_bpf 358
#define __NR_execveat 359
#endif /* _UAPI_ASM_CRIS_UNISTD_H_ */ #endif /* _UAPI_ASM_CRIS_UNISTD_H_ */
...@@ -8,6 +8,7 @@ extra-y := vmlinux.lds ...@@ -8,6 +8,7 @@ extra-y := vmlinux.lds
obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
obj-y += devicetree.o obj-y += devicetree.o
obj-y += stacktrace.o
obj-$(CONFIG_MODULES) += crisksyms.o obj-$(CONFIG_MODULES) += crisksyms.o
obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_MODULES) += module.o
......
...@@ -45,7 +45,11 @@ ...@@ -45,7 +45,11 @@
asmlinkage void do_IRQ(int irq, struct pt_regs * regs) asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
{ {
unsigned long sp; unsigned long sp;
struct pt_regs *old_regs = set_irq_regs(regs); struct pt_regs *old_regs;
trace_hardirqs_off();
old_regs = set_irq_regs(regs);
irq_enter(); irq_enter();
sp = rdsp(); sp = rdsp();
if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) { if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
......
#include <linux/sched.h>
#include <linux/stacktrace.h>
#include <linux/stacktrace.h>
#include <asm/stacktrace.h>
void walk_stackframe(unsigned long sp,
int (*fn)(unsigned long addr, void *data),
void *data)
{
unsigned long high = ALIGN(sp, THREAD_SIZE);
for (; sp <= high - 4; sp += 4) {
unsigned long addr = *(unsigned long *) sp;
if (!kernel_text_address(addr))
continue;
if (fn(addr, data))
break;
}
}
struct stack_trace_data {
struct stack_trace *trace;
unsigned int no_sched_functions;
unsigned int skip;
};
#ifdef CONFIG_STACKTRACE
static int save_trace(unsigned long addr, void *d)
{
struct stack_trace_data *data = d;
struct stack_trace *trace = data->trace;
if (data->no_sched_functions && in_sched_functions(addr))
return 0;
if (data->skip) {
data->skip--;
return 0;
}
trace->entries[trace->nr_entries++] = addr;
return trace->nr_entries >= trace->max_entries;
}
void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{
struct stack_trace_data data;
unsigned long sp;
data.trace = trace;
data.skip = trace->skip;
if (tsk != current) {
data.no_sched_functions = 1;
sp = tsk->thread.ksp;
} else {
data.no_sched_functions = 0;
sp = rdsp();
}
walk_stackframe(sp, save_trace, &data);
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX;
}
void save_stack_trace(struct stack_trace *trace)
{
save_stack_trace_tsk(current, trace);
}
EXPORT_SYMBOL_GPL(save_stack_trace);
#endif /* CONFIG_STACKTRACE */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment