2019-05-19 20:07:45 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2009-03-27 21:25:50 +08:00
|
|
|
config MICROBLAZE
|
|
|
|
def_bool y
|
32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option
All new 32-bit architectures should have 64-bit userspace off_t type, but
existing architectures has 32-bit ones.
To enforce the rule, new config option is added to arch/Kconfig that defaults
ARCH_32BIT_OFF_T to be disabled for new 32-bit architectures. All existing
32-bit architectures enable it explicitly.
New option affects force_o_largefile() behaviour. Namely, if userspace
off_t is 64-bits long, we have no reason to reject user to open big files.
Note that even if architectures has only 64-bit off_t in the kernel
(arc, c6x, h8300, hexagon, nios2, openrisc, and unicore32),
a libc may use 32-bit off_t, and therefore want to limit the file size
to 4GB unless specified differently in the open flags.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yury Norov <ynorov@marvell.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-05-16 16:18:49 +08:00
|
|
|
select ARCH_32BIT_OFF_T
|
2018-07-31 19:39:29 +08:00
|
|
|
select ARCH_NO_SWAP
|
2019-08-14 22:03:47 +08:00
|
|
|
select ARCH_HAS_DMA_PREP_COHERENT
|
2014-12-13 08:57:44 +08:00
|
|
|
select ARCH_HAS_GCOV_PROFILE_ALL
|
2018-07-19 20:54:39 +08:00
|
|
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
|
|
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
2013-10-08 10:12:28 +08:00
|
|
|
select ARCH_MIGHT_HAVE_PC_PARPORT
|
2012-07-31 05:42:46 +08:00
|
|
|
select ARCH_WANT_IPC_PARSE_VERSION
|
2019-12-04 08:46:31 +08:00
|
|
|
select BUILDTIME_TABLE_SORT
|
2017-05-27 01:34:11 +08:00
|
|
|
select TIMER_OF
|
2014-04-07 18:51:44 +08:00
|
|
|
select CLONE_BACKWARDS3
|
|
|
|
select COMMON_CLK
|
2020-11-26 21:32:25 +08:00
|
|
|
select DMA_DIRECT_REMAP
|
2014-04-07 18:51:44 +08:00
|
|
|
select GENERIC_ATOMIC64
|
|
|
|
select GENERIC_CPU_DEVICES
|
|
|
|
select GENERIC_IDLE_POLL_SETUP
|
2011-01-20 03:35:05 +08:00
|
|
|
select GENERIC_IRQ_PROBE
|
2011-03-24 21:55:52 +08:00
|
|
|
select GENERIC_IRQ_SHOW
|
2011-11-25 03:06:41 +08:00
|
|
|
select GENERIC_PCI_IOMAP
|
2013-12-20 17:16:40 +08:00
|
|
|
select GENERIC_SCHED_CLOCK
|
2016-05-25 23:06:09 +08:00
|
|
|
select HAVE_ARCH_HASH
|
2014-04-07 18:51:44 +08:00
|
|
|
select HAVE_ARCH_KGDB
|
seccomp: Move config option SECCOMP to arch/Kconfig
In order to make adding configurable features into seccomp easier,
it's better to have the options at one single location, considering
especially that the bulk of seccomp code is arch-independent. An quick
look also show that many SECCOMP descriptions are outdated; they talk
about /proc rather than prctl.
As a result of moving the config option and keeping it default on,
architectures arm, arm64, csky, riscv, sh, and xtensa did not have SECCOMP
on by default prior to this and SECCOMP will be default in this change.
Architectures microblaze, mips, powerpc, s390, sh, and sparc have an
outdated depend on PROC_FS and this dependency is removed in this change.
Suggested-by: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/lkml/CAG48ez1YWz9cnp08UZgeieYRhHdqh-ch7aNwc4JRBnGyrmgfMg@mail.gmail.com/
Signed-off-by: YiFei Zhu <yifeifz2@illinois.edu>
[kees: added HAVE_ARCH_SECCOMP help text, tweaked wording]
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/9ede6ef35c847e58d61e476c6a39540520066613.1600951211.git.yifeifz2@illinois.edu
2020-09-24 20:44:16 +08:00
|
|
|
select HAVE_ARCH_SECCOMP
|
2014-04-07 18:51:44 +08:00
|
|
|
select HAVE_DEBUG_KMEMLEAK
|
2020-01-14 17:05:24 +08:00
|
|
|
select HAVE_DMA_CONTIGUOUS
|
2014-04-07 18:51:44 +08:00
|
|
|
select HAVE_DYNAMIC_FTRACE
|
|
|
|
select HAVE_FTRACE_MCOUNT_RECORD
|
|
|
|
select HAVE_FUNCTION_GRAPH_TRACER
|
|
|
|
select HAVE_FUNCTION_TRACER
|
2018-11-16 03:05:32 +08:00
|
|
|
select HAVE_PCI
|
2014-04-07 18:51:44 +08:00
|
|
|
select IRQ_DOMAIN
|
2016-11-14 20:13:45 +08:00
|
|
|
select XILINX_INTC
|
2012-09-28 13:01:03 +08:00
|
|
|
select MODULES_USE_ELF_RELA
|
2014-04-07 18:51:44 +08:00
|
|
|
select OF
|
|
|
|
select OF_EARLY_FLATTREE
|
2018-11-16 03:05:33 +08:00
|
|
|
select PCI_DOMAINS_GENERIC if PCI
|
2018-11-16 03:05:34 +08:00
|
|
|
select PCI_SYSCALL if PCI
|
2014-04-07 18:51:44 +08:00
|
|
|
select VIRT_TO_BUS
|
lib/GCD.c: use binary GCD algorithm instead of Euclidean
The binary GCD algorithm is based on the following facts:
1. If a and b are all evens, then gcd(a,b) = 2 * gcd(a/2, b/2)
2. If a is even and b is odd, then gcd(a,b) = gcd(a/2, b)
3. If a and b are all odds, then gcd(a,b) = gcd((a-b)/2, b) = gcd((a+b)/2, b)
Even on x86 machines with reasonable division hardware, the binary
algorithm runs about 25% faster (80% the execution time) than the
division-based Euclidian algorithm.
On platforms like Alpha and ARMv6 where division is a function call to
emulation code, it's even more significant.
There are two variants of the code here, depending on whether a fast
__ffs (find least significant set bit) instruction is available. This
allows the unpredictable branches in the bit-at-a-time shifting loop to
be eliminated.
If fast __ffs is not available, the "even/odd" GCD variant is used.
I use the following code to benchmark:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#define swap(a, b) \
do { \
a ^= b; \
b ^= a; \
a ^= b; \
} while (0)
unsigned long gcd0(unsigned long a, unsigned long b)
{
unsigned long r;
if (a < b) {
swap(a, b);
}
if (b == 0)
return a;
while ((r = a % b) != 0) {
a = b;
b = r;
}
return b;
}
unsigned long gcd1(unsigned long a, unsigned long b)
{
unsigned long r = a | b;
if (!a || !b)
return r;
b >>= __builtin_ctzl(b);
for (;;) {
a >>= __builtin_ctzl(a);
if (a == b)
return a << __builtin_ctzl(r);
if (a < b)
swap(a, b);
a -= b;
}
}
unsigned long gcd2(unsigned long a, unsigned long b)
{
unsigned long r = a | b;
if (!a || !b)
return r;
r &= -r;
while (!(b & r))
b >>= 1;
for (;;) {
while (!(a & r))
a >>= 1;
if (a == b)
return a;
if (a < b)
swap(a, b);
a -= b;
a >>= 1;
if (a & r)
a += b;
a >>= 1;
}
}
unsigned long gcd3(unsigned long a, unsigned long b)
{
unsigned long r = a | b;
if (!a || !b)
return r;
b >>= __builtin_ctzl(b);
if (b == 1)
return r & -r;
for (;;) {
a >>= __builtin_ctzl(a);
if (a == 1)
return r & -r;
if (a == b)
return a << __builtin_ctzl(r);
if (a < b)
swap(a, b);
a -= b;
}
}
unsigned long gcd4(unsigned long a, unsigned long b)
{
unsigned long r = a | b;
if (!a || !b)
return r;
r &= -r;
while (!(b & r))
b >>= 1;
if (b == r)
return r;
for (;;) {
while (!(a & r))
a >>= 1;
if (a == r)
return r;
if (a == b)
return a;
if (a < b)
swap(a, b);
a -= b;
a >>= 1;
if (a & r)
a += b;
a >>= 1;
}
}
static unsigned long (*gcd_func[])(unsigned long a, unsigned long b) = {
gcd0, gcd1, gcd2, gcd3, gcd4,
};
#define TEST_ENTRIES (sizeof(gcd_func) / sizeof(gcd_func[0]))
#if defined(__x86_64__)
#define rdtscll(val) do { \
unsigned long __a,__d; \
__asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); \
(val) = ((unsigned long long)__a) | (((unsigned long long)__d)<<32); \
} while(0)
static unsigned long long benchmark_gcd_func(unsigned long (*gcd)(unsigned long, unsigned long),
unsigned long a, unsigned long b, unsigned long *res)
{
unsigned long long start, end;
unsigned long long ret;
unsigned long gcd_res;
rdtscll(start);
gcd_res = gcd(a, b);
rdtscll(end);
if (end >= start)
ret = end - start;
else
ret = ~0ULL - start + 1 + end;
*res = gcd_res;
return ret;
}
#else
static inline struct timespec read_time(void)
{
struct timespec time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time);
return time;
}
static inline unsigned long long diff_time(struct timespec start, struct timespec end)
{
struct timespec temp;
if ((end.tv_nsec - start.tv_nsec) < 0) {
temp.tv_sec = end.tv_sec - start.tv_sec - 1;
temp.tv_nsec = 1000000000ULL + end.tv_nsec - start.tv_nsec;
} else {
temp.tv_sec = end.tv_sec - start.tv_sec;
temp.tv_nsec = end.tv_nsec - start.tv_nsec;
}
return temp.tv_sec * 1000000000ULL + temp.tv_nsec;
}
static unsigned long long benchmark_gcd_func(unsigned long (*gcd)(unsigned long, unsigned long),
unsigned long a, unsigned long b, unsigned long *res)
{
struct timespec start, end;
unsigned long gcd_res;
start = read_time();
gcd_res = gcd(a, b);
end = read_time();
*res = gcd_res;
return diff_time(start, end);
}
#endif
static inline unsigned long get_rand()
{
if (sizeof(long) == 8)
return (unsigned long)rand() << 32 | rand();
else
return rand();
}
int main(int argc, char **argv)
{
unsigned int seed = time(0);
int loops = 100;
int repeats = 1000;
unsigned long (*res)[TEST_ENTRIES];
unsigned long long elapsed[TEST_ENTRIES];
int i, j, k;
for (;;) {
int opt = getopt(argc, argv, "n:r:s:");
/* End condition always first */
if (opt == -1)
break;
switch (opt) {
case 'n':
loops = atoi(optarg);
break;
case 'r':
repeats = atoi(optarg);
break;
case 's':
seed = strtoul(optarg, NULL, 10);
break;
default:
/* You won't actually get here. */
break;
}
}
res = malloc(sizeof(unsigned long) * TEST_ENTRIES * loops);
memset(elapsed, 0, sizeof(elapsed));
srand(seed);
for (j = 0; j < loops; j++) {
unsigned long a = get_rand();
/* Do we have args? */
unsigned long b = argc > optind ? strtoul(argv[optind], NULL, 10) : get_rand();
unsigned long long min_elapsed[TEST_ENTRIES];
for (k = 0; k < repeats; k++) {
for (i = 0; i < TEST_ENTRIES; i++) {
unsigned long long tmp = benchmark_gcd_func(gcd_func[i], a, b, &res[j][i]);
if (k == 0 || min_elapsed[i] > tmp)
min_elapsed[i] = tmp;
}
}
for (i = 0; i < TEST_ENTRIES; i++)
elapsed[i] += min_elapsed[i];
}
for (i = 0; i < TEST_ENTRIES; i++)
printf("gcd%d: elapsed %llu\n", i, elapsed[i]);
k = 0;
srand(seed);
for (j = 0; j < loops; j++) {
unsigned long a = get_rand();
unsigned long b = argc > optind ? strtoul(argv[optind], NULL, 10) : get_rand();
for (i = 1; i < TEST_ENTRIES; i++) {
if (res[j][i] != res[j][0])
break;
}
if (i < TEST_ENTRIES) {
if (k == 0) {
k = 1;
fprintf(stderr, "Error:\n");
}
fprintf(stderr, "gcd(%lu, %lu): ", a, b);
for (i = 0; i < TEST_ENTRIES; i++)
fprintf(stderr, "%ld%s", res[j][i], i < TEST_ENTRIES - 1 ? ", " : "\n");
}
}
if (k == 0)
fprintf(stderr, "PASS\n");
free(res);
return 0;
}
Compiled with "-O2", on "VirtualBox 4.4.0-22-generic #38-Ubuntu x86_64" got:
zhaoxiuzeng@zhaoxiuzeng-VirtualBox:~/develop$ ./gcd -r 500000 -n 10
gcd0: elapsed 10174
gcd1: elapsed 2120
gcd2: elapsed 2902
gcd3: elapsed 2039
gcd4: elapsed 2812
PASS
zhaoxiuzeng@zhaoxiuzeng-VirtualBox:~/develop$ ./gcd -r 500000 -n 10
gcd0: elapsed 9309
gcd1: elapsed 2280
gcd2: elapsed 2822
gcd3: elapsed 2217
gcd4: elapsed 2710
PASS
zhaoxiuzeng@zhaoxiuzeng-VirtualBox:~/develop$ ./gcd -r 500000 -n 10
gcd0: elapsed 9589
gcd1: elapsed 2098
gcd2: elapsed 2815
gcd3: elapsed 2030
gcd4: elapsed 2718
PASS
zhaoxiuzeng@zhaoxiuzeng-VirtualBox:~/develop$ ./gcd -r 500000 -n 10
gcd0: elapsed 9914
gcd1: elapsed 2309
gcd2: elapsed 2779
gcd3: elapsed 2228
gcd4: elapsed 2709
PASS
[akpm@linux-foundation.org: avoid #defining a CONFIG_ variable]
Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
Signed-off-by: George Spelvin <linux@horizon.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-21 08:03:57 +08:00
|
|
|
select CPU_NO_EFFICIENT_FFS
|
2020-11-26 21:32:25 +08:00
|
|
|
select MMU_GATHER_NO_RANGE
|
2017-08-08 22:06:52 +08:00
|
|
|
select SPARSE_IRQ
|
2020-09-03 22:22:35 +08:00
|
|
|
select SET_FS
|
2009-03-27 21:25:50 +08:00
|
|
|
|
2017-09-09 07:14:25 +08:00
|
|
|
# Endianness selection
|
|
|
|
choice
|
|
|
|
prompt "Endianness selection"
|
2017-09-19 00:53:29 +08:00
|
|
|
default CPU_LITTLE_ENDIAN
|
2017-09-09 07:14:25 +08:00
|
|
|
help
|
|
|
|
microblaze architectures can be configured for either little or
|
|
|
|
big endian formats. Be sure to select the appropriate mode.
|
|
|
|
|
|
|
|
config CPU_BIG_ENDIAN
|
|
|
|
bool "Big endian"
|
|
|
|
|
|
|
|
config CPU_LITTLE_ENDIAN
|
|
|
|
bool "Little endian"
|
|
|
|
|
|
|
|
endchoice
|
|
|
|
|
2011-12-15 16:24:06 +08:00
|
|
|
config ZONE_DMA
|
|
|
|
def_bool y
|
|
|
|
|
2009-03-27 21:25:50 +08:00
|
|
|
config ARCH_HAS_ILOG2_U32
|
|
|
|
def_bool n
|
|
|
|
|
|
|
|
config ARCH_HAS_ILOG2_U64
|
|
|
|
def_bool n
|
|
|
|
|
|
|
|
config GENERIC_HWEIGHT
|
|
|
|
def_bool y
|
|
|
|
|
|
|
|
config GENERIC_CALIBRATE_DELAY
|
|
|
|
def_bool y
|
|
|
|
|
2009-06-19 01:55:32 +08:00
|
|
|
config GENERIC_CSUM
|
|
|
|
def_bool y
|
|
|
|
|
2009-11-10 22:57:01 +08:00
|
|
|
config STACKTRACE_SUPPORT
|
|
|
|
def_bool y
|
|
|
|
|
2009-12-10 19:07:02 +08:00
|
|
|
config LOCKDEP_SUPPORT
|
|
|
|
def_bool y
|
|
|
|
|
2014-04-07 19:05:00 +08:00
|
|
|
source "arch/microblaze/Kconfig.platform"
|
2009-03-27 21:25:50 +08:00
|
|
|
|
|
|
|
menu "Processor type and features"
|
|
|
|
|
|
|
|
source "kernel/Kconfig.hz"
|
|
|
|
|
|
|
|
config MMU
|
2020-11-26 21:32:25 +08:00
|
|
|
def_bool y
|
2009-03-27 21:25:50 +08:00
|
|
|
|
|
|
|
comment "Boot options"
|
|
|
|
|
|
|
|
config CMDLINE_BOOL
|
|
|
|
bool "Default bootloader kernel arguments"
|
|
|
|
|
|
|
|
config CMDLINE
|
|
|
|
string "Default kernel command string"
|
|
|
|
depends on CMDLINE_BOOL
|
|
|
|
default "console=ttyUL0,115200"
|
|
|
|
help
|
|
|
|
On some architectures there is currently no way for the boot loader
|
|
|
|
to pass arguments to the kernel. For these architectures, you should
|
|
|
|
supply some command-line options at build time by entering them
|
|
|
|
here.
|
|
|
|
|
|
|
|
config CMDLINE_FORCE
|
|
|
|
bool "Force default kernel command string"
|
|
|
|
depends on CMDLINE_BOOL
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
Set this to have arguments from the default kernel command string
|
|
|
|
override those passed by the boot loader.
|
|
|
|
|
|
|
|
endmenu
|
|
|
|
|
2014-09-01 22:23:54 +08:00
|
|
|
menu "Kernel features"
|
2009-05-26 22:30:31 +08:00
|
|
|
|
2014-10-27 15:28:16 +08:00
|
|
|
config NR_CPUS
|
|
|
|
int
|
|
|
|
default "1"
|
|
|
|
|
2009-05-26 22:30:31 +08:00
|
|
|
config ADVANCED_OPTIONS
|
|
|
|
bool "Prompt for advanced kernel configuration options"
|
|
|
|
help
|
|
|
|
This option will enable prompting for a variety of advanced kernel
|
|
|
|
configuration options. These options can cause the kernel to not
|
|
|
|
work if they are set incorrectly, but can be used to optimize certain
|
|
|
|
aspects of kernel memory management.
|
|
|
|
|
|
|
|
Unless you know what you are doing, say N here.
|
|
|
|
|
|
|
|
comment "Default settings for advanced configuration options are used"
|
|
|
|
depends on !ADVANCED_OPTIONS
|
|
|
|
|
2011-12-15 22:02:37 +08:00
|
|
|
config HIGHMEM
|
|
|
|
bool "High memory support"
|
2020-11-03 17:27:24 +08:00
|
|
|
select KMAP_LOCAL
|
2009-05-26 22:30:31 +08:00
|
|
|
help
|
2011-12-15 22:02:37 +08:00
|
|
|
The address space of Microblaze processors is only 4 Gigabytes large
|
|
|
|
and it has to accommodate user address space, kernel address
|
|
|
|
space as well as some memory mapped IO. That means that, if you
|
|
|
|
have a large amount of physical memory and/or IO, not all of the
|
|
|
|
memory can be "permanently mapped" by the kernel. The physical
|
|
|
|
memory that is not permanently mapped is called "high memory".
|
2009-05-26 22:30:31 +08:00
|
|
|
|
2011-12-15 22:02:37 +08:00
|
|
|
If unsure, say n.
|
2009-05-26 22:30:31 +08:00
|
|
|
|
|
|
|
config LOWMEM_SIZE_BOOL
|
|
|
|
bool "Set maximum low memory"
|
2020-11-26 21:32:25 +08:00
|
|
|
depends on ADVANCED_OPTIONS
|
2009-05-26 22:30:31 +08:00
|
|
|
help
|
|
|
|
This option allows you to set the maximum amount of memory which
|
|
|
|
will be used as "low memory", that is, memory which the kernel can
|
|
|
|
access directly, without having to set up a kernel virtual mapping.
|
|
|
|
This can be useful in optimizing the layout of kernel virtual
|
|
|
|
memory.
|
|
|
|
|
|
|
|
Say N here unless you know what you are doing.
|
|
|
|
|
|
|
|
config LOWMEM_SIZE
|
|
|
|
hex "Maximum low memory size (in bytes)" if LOWMEM_SIZE_BOOL
|
|
|
|
default "0x30000000"
|
|
|
|
|
2010-11-08 19:37:40 +08:00
|
|
|
config MANUAL_RESET_VECTOR
|
|
|
|
hex "Microblaze reset vector address setup"
|
|
|
|
default "0x0"
|
|
|
|
help
|
|
|
|
Set this option to have the kernel override the CPU Reset vector.
|
|
|
|
If zero, no change will be made to the MicroBlaze reset vector at
|
|
|
|
address 0x0.
|
|
|
|
If non-zero, a jump instruction to this address, will be written
|
|
|
|
to the reset vector at address 0x0.
|
|
|
|
If you are unsure, set it to default value 0x0.
|
|
|
|
|
2009-05-26 22:30:31 +08:00
|
|
|
config KERNEL_START_BOOL
|
|
|
|
bool "Set custom kernel base address"
|
|
|
|
depends on ADVANCED_OPTIONS
|
|
|
|
help
|
|
|
|
This option allows you to set the kernel virtual address at which
|
|
|
|
the kernel will map low memory (the kernel image will be linked at
|
|
|
|
this address). This can be useful in optimizing the virtual memory
|
|
|
|
layout of the system.
|
|
|
|
|
|
|
|
Say N here unless you know what you are doing.
|
|
|
|
|
|
|
|
config KERNEL_START
|
|
|
|
hex "Virtual address of kernel base" if KERNEL_START_BOOL
|
2020-11-26 21:32:25 +08:00
|
|
|
default "0xc0000000"
|
2009-05-26 22:30:31 +08:00
|
|
|
|
|
|
|
config TASK_SIZE_BOOL
|
|
|
|
bool "Set custom user task size"
|
2020-11-26 21:32:25 +08:00
|
|
|
depends on ADVANCED_OPTIONS
|
2009-05-26 22:30:31 +08:00
|
|
|
help
|
|
|
|
This option allows you to set the amount of virtual address space
|
|
|
|
allocated to user tasks. This can be useful in optimizing the
|
|
|
|
virtual memory layout of the system.
|
|
|
|
|
|
|
|
Say N here unless you know what you are doing.
|
|
|
|
|
|
|
|
config TASK_SIZE
|
|
|
|
hex "Size of user task space" if TASK_SIZE_BOOL
|
|
|
|
default "0x80000000"
|
|
|
|
|
2009-03-27 21:25:50 +08:00
|
|
|
endmenu
|
|
|
|
|
2010-01-18 22:27:10 +08:00
|
|
|
menu "Bus Options"
|
|
|
|
|
2010-01-18 22:27:11 +08:00
|
|
|
config PCI_XILINX
|
|
|
|
bool "Xilinx PCI host bridge support"
|
|
|
|
depends on PCI
|
|
|
|
|
2010-01-18 22:27:10 +08:00
|
|
|
endmenu
|