diff options
Diffstat (limited to 'arch/nios2')
-rwxr-xr-x | arch/nios2/boot/dts/10m50_devboard.dts | 1 | ||||
-rw-r--r-- | arch/nios2/include/asm/cpuinfo.h | 8 | ||||
-rw-r--r-- | arch/nios2/include/asm/uaccess.h | 13 | ||||
-rw-r--r-- | arch/nios2/kernel/cpuinfo.c | 15 | ||||
-rw-r--r-- | arch/nios2/kernel/vmlinux.lds.S | 1 |
5 files changed, 19 insertions, 19 deletions
diff --git a/arch/nios2/boot/dts/10m50_devboard.dts b/arch/nios2/boot/dts/10m50_devboard.dts index 3e411c644824..f362b2224ee7 100755 --- a/arch/nios2/boot/dts/10m50_devboard.dts +++ b/arch/nios2/boot/dts/10m50_devboard.dts @@ -83,6 +83,7 @@ fifo-size = <32>; reg-io-width = <4>; reg-shift = <2>; + tx-threshold = <16>; }; sysid: sysid@18001528 { diff --git a/arch/nios2/include/asm/cpuinfo.h b/arch/nios2/include/asm/cpuinfo.h index e88fcae464d9..348bb228fec9 100644 --- a/arch/nios2/include/asm/cpuinfo.h +++ b/arch/nios2/include/asm/cpuinfo.h @@ -25,10 +25,10 @@ struct cpuinfo { /* Core CPU configuration */ char cpu_impl[12]; u32 cpu_clock_freq; - u32 mmu; - u32 has_div; - u32 has_mul; - u32 has_mulx; + bool mmu; + bool has_div; + bool has_mul; + bool has_mulx; /* CPU caches */ u32 icache_line_size; diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h index caa51ff85a3c..0ab82324c817 100644 --- a/arch/nios2/include/asm/uaccess.h +++ b/arch/nios2/include/asm/uaccess.h @@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *to, const void *from, unsigned long n); static inline long copy_from_user(void *to, const void __user *from, unsigned long n) { - if (!access_ok(VERIFY_READ, from, n)) - return n; - return __copy_from_user(to, from, n); + unsigned long res = n; + if (access_ok(VERIFY_READ, from, n)) + res = __copy_from_user(to, from, n); + if (unlikely(res)) + memset(to + (n - res), 0, res); + return res; } static inline long copy_to_user(void __user *to, const void *from, @@ -139,7 +142,7 @@ extern long strnlen_user(const char __user *s, long n); #define __get_user_unknown(val, size, ptr, err) do { \ err = 0; \ - if (copy_from_user(&(val), ptr, size)) { \ + if (__copy_from_user(&(val), ptr, size)) { \ err = -EFAULT; \ } \ } while (0) @@ -166,7 +169,7 @@ do { \ ({ \ long __gu_err = -EFAULT; \ const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ - unsigned long __gu_val; \ + unsigned long __gu_val = 0; \ __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ (x) = (__force __typeof__(x))__gu_val; \ __gu_err; \ diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c index 1d96de0bd4aa..1cccc36877bc 100644 --- a/arch/nios2/kernel/cpuinfo.c +++ b/arch/nios2/kernel/cpuinfo.c @@ -41,11 +41,6 @@ static inline u32 fcpu(struct device_node *cpu, const char *n) return val; } -static inline u32 fcpu_has(struct device_node *cpu, const char *n) -{ - return of_get_property(cpu, n, NULL) ? 1 : 0; -} - void __init setup_cpuinfo(void) { struct device_node *cpu; @@ -56,7 +51,7 @@ void __init setup_cpuinfo(void) if (!cpu) panic("%s: No CPU found in devicetree!\n", __func__); - if (!fcpu_has(cpu, "altr,has-initda")) + if (!of_property_read_bool(cpu, "altr,has-initda")) panic("initda instruction is unimplemented. Please update your " "hardware system to have more than 4-byte line data " "cache\n"); @@ -69,10 +64,10 @@ void __init setup_cpuinfo(void) else strcpy(cpuinfo.cpu_impl, "<unknown>"); - cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); - cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); - cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); - cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu"); + cpuinfo.has_div = of_property_read_bool(cpu, "altr,has-div"); + cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul"); + cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx"); + cpuinfo.mmu = of_property_read_bool(cpu, "altr,has-mmu"); if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) err_cpu("DIV"); diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S index e23e89539967..6a8045bb1a77 100644 --- a/arch/nios2/kernel/vmlinux.lds.S +++ b/arch/nios2/kernel/vmlinux.lds.S @@ -37,6 +37,7 @@ SECTIONS .text : { TEXT_TEXT SCHED_TEXT + CPUIDLE_TEXT LOCK_TEXT IRQENTRY_TEXT SOFTIRQENTRY_TEXT |