Skip to content

Commit

Permalink
arch/tile: Miscellaneous cleanup changes.
Browse files Browse the repository at this point in the history
This commit is primarily changes caused by reviewing "sparse"
and "checkpatch" output on our sources, so is somewhat noisy, since
things like "printk() -> pr_err()" (or whatever) throughout the
codebase tend to get tedious to read.  Rather than trying to tease
apart precisely which things changed due to which type of code
review, this commit includes various cleanups in the code:

- sparse: Add declarations in headers for globals.
- sparse: Fix __user annotations.
- sparse: Using gfp_t consistently instead of int.
- sparse: removing functions not actually used.
- checkpatch: Clean up printk() warnings by using pr_info(), etc.;
  also avoid partial-line printks except in bootup code.
  - checkpatch: Use exposed structs rather than typedefs.
  - checkpatch: Change some C99 comments to C89 comments.

In addition, a couple of minor other changes are rolled in
to this commit:

- Add support for a "raise" instruction to cause SIGFPE, etc., to be raised.
- Remove some compat code that is unnecessary when we fully eliminate
  some of the deprecated syscalls from the generic syscall ABI.
- Update the tile_defconfig to reflect current config contents.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Chris Metcalf committed Jul 6, 2010
1 parent c78095b commit 0707ad3
Show file tree
Hide file tree
Showing 56 changed files with 798 additions and 679 deletions.
15 changes: 8 additions & 7 deletions arch/tile/configs/tile_defconfig
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.34
# Fri May 28 17:51:43 2010
# Thu Jun 3 13:20:05 2010
#
CONFIG_MMU=y
CONFIG_GENERIC_CSUM=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_ZONE_DMA=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_HAVE_ARCH_ALLOC_REMAP=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_DEFAULT_MIGRATION_COST=10000000
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
Expand All @@ -32,7 +29,6 @@ CONFIG_STRICT_DEVMEM=y
CONFIG_SMP=y
CONFIG_WERROR=y
# CONFIG_DEBUG_COPY_FROM_USER is not set
CONFIG_SERIAL_CONSOLE=y
CONFIG_HVC_TILE=y
CONFIG_TILE=y
# CONFIG_TILEGX is not set
Expand Down Expand Up @@ -86,6 +82,7 @@ CONFIG_INITRAMFS_COMPRESSION_NONE=y
# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
# CONFIG_INITRAMFS_COMPRESSION_LZO is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_EMBEDDED=y
Expand Down Expand Up @@ -220,7 +217,7 @@ CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MIGRATION=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_ZONE_DMA_FLAG=1
CONFIG_ZONE_DMA_FLAG=0
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
# CONFIG_KSM is not set
Expand All @@ -232,10 +229,11 @@ CONFIG_FEEDBACK_USE=""
CONFIG_VMALLOC_RESERVE=0x1000000
CONFIG_HARDWALL=y
CONFIG_MEMPROF=y
CONFIG_XGBE_MAIN=y
CONFIG_XGBE=y
CONFIG_NET_TILE=y
CONFIG_PSEUDO_NAPI=y
CONFIG_TILEPCI_ENDP=y
CONFIG_TILEPCI_HOST_SUBSET=m
CONFIG_TILE_IDE_GPIO=y
CONFIG_TILE_SOFTUART=y

Expand All @@ -244,6 +242,8 @@ CONFIG_TILE_SOFTUART=y
#
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
# CONFIG_NO_IOMEM is not set
# CONFIG_NO_IOPORT is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_PCI_DEBUG=y
# CONFIG_PCI_STUB is not set
Expand Down Expand Up @@ -742,6 +742,7 @@ CONFIG_HVC_DRIVER=y
#
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
Expand Down
69 changes: 37 additions & 32 deletions arch/tile/include/arch/abi.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
// Copyright 2010 Tilera Corporation. All Rights Reserved.
//
// 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, version 2.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
// NON INFRINGEMENT. See the GNU General Public License for
// more details.

//! @file
//!
//! ABI-related register definitions helpful when writing assembly code.
//!
/*
* Copyright 2010 Tilera Corporation. All Rights Reserved.
*
* 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, version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*/

/**
* @file
*
* ABI-related register definitions helpful when writing assembly code.
*/

#ifndef __ARCH_ABI_H__
#define __ARCH_ABI_H__

#include <arch/chip.h>

// Registers 0 - 55 are "normal", but some perform special roles.
/* Registers 0 - 55 are "normal", but some perform special roles. */

#define TREG_FP 52 /**< Frame pointer. */
#define TREG_TP 53 /**< Thread pointer. */
Expand All @@ -30,7 +33,7 @@
/** Index of last normal general-purpose register. */
#define TREG_LAST_GPR 55

// Registers 56 - 62 are "special" network registers.
/* Registers 56 - 62 are "special" network registers. */

#define TREG_SN 56 /**< Static network access. */
#define TREG_IDN0 57 /**< IDN demux 0 access. */
Expand All @@ -40,7 +43,7 @@
#define TREG_UDN2 61 /**< UDN demux 2 access. */
#define TREG_UDN3 62 /**< UDN demux 3 access. */

// Register 63 is the "special" zero register.
/* Register 63 is the "special" zero register. */

#define TREG_ZERO 63 /**< "Zero" register; always reads as "0". */

Expand All @@ -52,42 +55,44 @@
#define TREG_SYSCALL_NR_NAME r10


//! The ABI requires callers to allocate a caller state save area of
//! this many bytes at the bottom of each stack frame.
//!
/**
* The ABI requires callers to allocate a caller state save area of
* this many bytes at the bottom of each stack frame.
*/
#ifdef __tile__
#define C_ABI_SAVE_AREA_SIZE (2 * __SIZEOF_POINTER__)
#endif

//! The operand to an 'info' opcode directing the backtracer to not
//! try to find the calling frame.
//!
/**
* The operand to an 'info' opcode directing the backtracer to not
* try to find the calling frame.
*/
#define INFO_OP_CANNOT_BACKTRACE 2

#ifndef __ASSEMBLER__
#if CHIP_WORD_SIZE() > 32

//! Unsigned type that can hold a register.
/** Unsigned type that can hold a register. */
typedef unsigned long long uint_reg_t;

//! Signed type that can hold a register.
/** Signed type that can hold a register. */
typedef long long int_reg_t;

//! String prefix to use for printf().
/** String prefix to use for printf(). */
#define INT_REG_FMT "ll"

#elif !defined(__LP64__) /* avoid confusion with LP64 cross-build tools */

//! Unsigned type that can hold a register.
/** Unsigned type that can hold a register. */
typedef unsigned long uint_reg_t;

//! Signed type that can hold a register.
/** Signed type that can hold a register. */
typedef long int_reg_t;

//! String prefix to use for printf().
/** String prefix to use for printf(). */
#define INT_REG_FMT "l"

#endif
#endif /* __ASSEMBLER__ */

#endif // !__ARCH_ABI_H__
#endif /* !__ARCH_ABI_H__ */
2 changes: 1 addition & 1 deletion arch/tile/include/arch/interrupts_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,4 @@
INT_MASK(INT_DOUBLE_FAULT) | \
INT_MASK(INT_AUX_PERF_COUNT) | \
0)
#endif // !__ARCH_INTERRUPTS_H__
#endif /* !__ARCH_INTERRUPTS_H__ */
17 changes: 17 additions & 0 deletions arch/tile/include/asm/atomic_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,23 @@ void __init_atomic_per_cpu(void);
/* Support releasing the atomic lock in do_page_fault_ics(). */
void __atomic_fault_unlock(int *lock_ptr);
#endif

/* Private helper routines in lib/atomic_asm_32.S */
extern struct __get_user __atomic_cmpxchg(volatile int *p,
int *lock, int o, int n);
extern struct __get_user __atomic_xchg(volatile int *p, int *lock, int n);
extern struct __get_user __atomic_xchg_add(volatile int *p, int *lock, int n);
extern struct __get_user __atomic_xchg_add_unless(volatile int *p,
int *lock, int o, int n);
extern struct __get_user __atomic_or(volatile int *p, int *lock, int n);
extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n);
extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n);
extern u64 __atomic64_cmpxchg(volatile u64 *p, int *lock, u64 o, u64 n);
extern u64 __atomic64_xchg(volatile u64 *p, int *lock, u64 n);
extern u64 __atomic64_xchg_add(volatile u64 *p, int *lock, u64 n);
extern u64 __atomic64_xchg_add_unless(volatile u64 *p,
int *lock, u64 o, u64 n);

#endif /* !__ASSEMBLY__ */

#endif /* _ASM_TILE_ATOMIC_32_H */
55 changes: 2 additions & 53 deletions arch/tile/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,48 +70,7 @@ struct compat_timeval {
s32 tv_usec;
};

struct compat_stat {
unsigned int st_dev;
unsigned int st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned int st_rdev;
unsigned int __pad1;
int st_size;
int st_blksize;
int __pad2;
int st_blocks;
int st_atime;
unsigned int st_atime_nsec;
int st_mtime;
unsigned int st_mtime_nsec;
int st_ctime;
unsigned int st_ctime_nsec;
unsigned int __unused[2];
};

struct compat_stat64 {
unsigned long st_dev;
unsigned long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned long st_rdev;
long st_size;
unsigned int st_blksize;
unsigned long st_blocks __attribute__((packed));
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int __unused8;
};

#define compat_stat stat
#define compat_statfs statfs

struct compat_sysctl {
Expand Down Expand Up @@ -233,7 +192,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
/* Sign-extend when storing a kernel pointer to a user's ptregs. */
static inline unsigned long ptr_to_compat_reg(void __user *uptr)
{
return (long)(int)(long)uptr;
return (long)(int)(long __force)uptr;
}

static inline void __user *compat_alloc_user_space(long len)
Expand Down Expand Up @@ -278,17 +237,8 @@ long compat_sys_sync_file_range2(int fd, unsigned int flags,
long compat_sys_fallocate(int fd, int mode,
u32 offset_lo, u32 offset_hi,
u32 len_lo, u32 len_hi);
long compat_sys_stat64(char __user *filename,
struct compat_stat64 __user *statbuf);
long compat_sys_lstat64(char __user *filename,
struct compat_stat64 __user *statbuf);
long compat_sys_fstat64(unsigned int fd, struct compat_stat64 __user *statbuf);
long compat_sys_fstatat64(int dfd, char __user *filename,
struct compat_stat64 __user *statbuf, int flag);
long compat_sys_sched_rr_get_interval(compat_pid_t pid,
struct compat_timespec __user *interval);
ssize_t compat_sys_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
size_t count);

/* Versions of compat functions that differ from generic Linux. */
struct compat_msgbuf;
Expand All @@ -302,7 +252,6 @@ long tile_compat_sys_ptrace(compat_long_t request, compat_long_t pid,
compat_long_t addr, compat_long_t data);

/* Tilera Linux syscalls that don't have "compat" versions. */
#define compat_sys_raise_fpe sys_raise_fpe
#define compat_sys_flush_cache sys_flush_cache

#endif /* _ASM_TILE_COMPAT_H */
6 changes: 2 additions & 4 deletions arch/tile/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ enum { ELF_ARCH = CHIP_ELF_TYPE() };
*/
#define elf_check_arch(x) \
((x)->e_ident[EI_CLASS] == ELF_CLASS && \
((x)->e_machine == CHIP_ELF_TYPE() || \
(x)->e_machine == CHIP_COMPAT_ELF_TYPE()))
(x)->e_machine == CHIP_ELF_TYPE())

/* The module loader only handles a few relocation types. */
#ifndef __tilegx__
Expand Down Expand Up @@ -139,8 +138,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
*/
#define compat_elf_check_arch(x) \
((x)->e_ident[EI_CLASS] == ELFCLASS32 && \
((x)->e_machine == CHIP_ELF_TYPE() || \
(x)->e_machine == CHIP_COMPAT_ELF_TYPE()))
(x)->e_machine == CHIP_ELF_TYPE())

#define compat_start_thread(regs, ip, usp) do { \
regs->pc = ptr_to_compat_reg((void *)(ip)); \
Expand Down
17 changes: 11 additions & 6 deletions arch/tile/include/asm/futex.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
#include <linux/uaccess.h>
#include <linux/errno.h>

extern struct __get_user futex_set(int *v, int i);
extern struct __get_user futex_add(int *v, int n);
extern struct __get_user futex_or(int *v, int n);
extern struct __get_user futex_andn(int *v, int n);
extern struct __get_user futex_cmpxchg(int *v, int o, int n);
extern struct __get_user futex_set(int __user *v, int i);
extern struct __get_user futex_add(int __user *v, int n);
extern struct __get_user futex_or(int __user *v, int n);
extern struct __get_user futex_andn(int __user *v, int n);
extern struct __get_user futex_cmpxchg(int __user *v, int o, int n);

#ifndef __tilegx__
extern struct __get_user futex_xor(int *v, int n);
extern struct __get_user futex_xor(int __user *v, int n);
#else
static inline struct __get_user futex_xor(int __user *uaddr, int n)
{
Expand Down Expand Up @@ -131,6 +131,11 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
return asm_ret.err ? asm_ret.err : asm_ret.val;
}

#ifndef __tilegx__
/* Return failure from the atomic wrappers. */
struct __get_user __atomic_bad_address(int __user *addr);
#endif

#endif /* !__ASSEMBLY__ */

#endif /* _ASM_TILE_FUTEX_H */
9 changes: 7 additions & 2 deletions arch/tile/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#define _ASM_TILE_PAGE_H

#include <linux/const.h>
#include <hv/hypervisor.h>
#include <arch/chip.h>

/* PAGE_SHIFT and HPAGE_SHIFT determine the page sizes. */
#define PAGE_SHIFT 16
Expand All @@ -29,6 +27,11 @@
#define PAGE_MASK (~(PAGE_SIZE - 1))
#define HPAGE_MASK (~(HPAGE_SIZE - 1))

#ifdef __KERNEL__

#include <hv/hypervisor.h>
#include <arch/chip.h>

/*
* The {,H}PAGE_SHIFT values must match the HV_LOG2_PAGE_SIZE_xxx
* definitions in <hv/hypervisor.h>. We validate this at build time
Expand Down Expand Up @@ -331,4 +334,6 @@ extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
#include <asm-generic/memory_model.h>
#include <asm-generic/getorder.h>

#endif /* __KERNEL__ */

#endif /* _ASM_TILE_PAGE_H */
Loading

0 comments on commit 0707ad3

Please sign in to comment.