* Re: [Qemu-devel] [PATCH 15/15] tcg: use ext op for deposit
From: Alexander Graf @ 2011-04-10 20:17 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: peter.maydell, QEMU-devel Developers, Richard Henderson
In-Reply-To: <20110410200812.GF4551@volta.aurel32.net>
On 10.04.2011, at 22:08, Aurelien Jarno wrote:
> On Sun, Apr 10, 2011 at 09:25:33PM +0200, Alexander Graf wrote:
>>
>> On 10.04.2011, at 21:23, Aurelien Jarno wrote:
>>
>>> On Tue, Apr 05, 2011 at 09:55:09AM +0200, Alexander Graf wrote:
>>>>
>>>> On 05.04.2011, at 06:54, Aurelien Jarno wrote:
>>>>
>>>>> On Mon, Apr 04, 2011 at 04:32:24PM +0200, Alexander Graf wrote:
>>>>>> With the s390x target we use the deposit instruction to store 32bit values
>>>>>> into 64bit registers without clobbering the upper 32 bits.
>>>>>>
>>>>>> This specific operation can be optimized slightly by using the ext operation
>>>>>> instead of an explicit and in the deposit instruction. This patch adds that
>>>>>> special case to the generic deposit implementation.
>>>>>>
>>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>>> ---
>>>>>> tcg/tcg-op.h | 6 +++++-
>>>>>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>>>>
>>>>> Have you really measuring a difference here? This should already be
>>>>> handled, at least on x86, by this code:
>>>>>
>>>>> if (TCG_TARGET_REG_BITS == 64) {
>>>>> if (val == 0xffffffffu) {
>>>>> tcg_out_ext32u(s, r0, r0);
>>>>> return;
>>>>> }
>>>>> if (val == (uint32_t)val) {
>>>>> /* AND with no high bits set can use a 32-bit operation. */
>>>>> rexw = 0;
>>>>> }
>>>>> }
>>>>
>>>> I've certainly looked at the -d op logs and seen that instead of creating a const tcg variable plus an AND there was now an extu opcode issued, yes. No idea why the case up there didn't trigger.
>>>>
>>>
>>> The question there is looking at -d out_asm. They should be the same at
>>> the end as the code I pasted above is from tcg/i386/tcg-target.c.
>>
>> Yes. I was trying to optimize for maximum op length. TCG defines a maximum number of tcg ops to be issued by each target instruction. Since s390 is very CISCy, there are instructions that translate into lots of microops, but are still faster than a C call (register save/restore mostly).
>>
>> Without this patch, there are some places where we hit that number :).
>
> Is it on 32-bit on or 64-bit? If we reach this number, it's probably
> better to either implement this instruction with an helper, or maybe
> increase the number of maximum ops. What is this instruction?
This was on x86_64. I hit limits with LMH and LM, but reduced them to fit into the picture with this optimization :). If you like, I can give you a statically linked binary that could exceed the limits.
Alex
^ permalink raw reply
* Re: [Qemu-devel] [PATCH 03/15] s390x: s390x-linux-user support
From: Aurelien Jarno @ 2011-04-10 20:16 UTC (permalink / raw)
To: Alexander Graf
Cc: peter.maydell, Riku Voipio, QEMU-devel Developers,
Richard Henderson
In-Reply-To: <1301927544-32767-4-git-send-email-agraf@suse.de>
On Mon, Apr 04, 2011 at 04:32:12PM +0200, Alexander Graf wrote:
> From: Ulrich Hecht <uli@suse.de>
>
> This patch adds support for running s390x binaries in the linux-user emulation
> code.
>
> Signed-off-by: Ulrich Hecht <uli@suse.de>
> Signed-off-by: Alexander Graf <agraf@suse.de>
>
> ---
>
> v1 -> v2:
>
> - always set 64bit flag for s390x binaries in elf loader
> - remove redundant EXECUTE_SVC
> - advance psw.addr in syscall execution path
> ---
> linux-user/elfload.c | 19 ++
> linux-user/main.c | 83 +++++++++
> linux-user/s390x/syscall.h | 25 +++
> linux-user/s390x/syscall_nr.h | 349 ++++++++++++++++++++++++++++++++++++++
> linux-user/s390x/target_signal.h | 26 +++
> linux-user/s390x/termbits.h | 283 ++++++++++++++++++++++++++++++
> linux-user/signal.c | 314 ++++++++++++++++++++++++++++++++++
> linux-user/syscall.c | 18 ++-
> linux-user/syscall_defs.h | 56 ++++++-
> s390x.ld | 194 +++++++++++++++++++++
> scripts/qemu-binfmt-conf.sh | 4 +-
> 11 files changed, 1363 insertions(+), 8 deletions(-)
> create mode 100644 linux-user/s390x/syscall.h
> create mode 100644 linux-user/s390x/syscall_nr.h
> create mode 100644 linux-user/s390x/target_signal.h
> create mode 100644 linux-user/s390x/termbits.h
> create mode 100644 s390x.ld
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index fe5410e..489f839 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -793,6 +793,25 @@ static inline void init_thread(struct target_pt_regs *regs,
>
> #endif /* TARGET_ALPHA */
>
> +#ifdef TARGET_S390X
> +
> +#define ELF_START_MMAP (0x20000000000ULL)
> +
> +#define elf_check_arch(x) ( (x) == ELF_ARCH )
> +
> +#define ELF_CLASS ELFCLASS64
> +#define ELF_DATA ELFDATA2MSB
> +#define ELF_ARCH EM_S390
> +
> +static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
> +{
> + regs->psw.addr = infop->entry;
> + regs->psw.mask = PSW_MASK_64 | PSW_MASK_32;
> + regs->gprs[15] = infop->start_stack;
> +}
> +
> +#endif /* TARGET_S390X */
> +
> #ifndef ELF_PLATFORM
> #define ELF_PLATFORM (NULL)
> #endif
> diff --git a/linux-user/main.c b/linux-user/main.c
> index e651bfd..362b8cb 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -2624,6 +2624,80 @@ void cpu_loop (CPUState *env)
> }
> #endif /* TARGET_ALPHA */
>
> +#ifdef TARGET_S390X
> +void cpu_loop(CPUS390XState *env)
> +{
> + int trapnr;
> + target_siginfo_t info;
> +
> + while (1) {
> + trapnr = cpu_s390x_exec (env);
> +
> + switch (trapnr) {
> + case EXCP_INTERRUPT:
> + /* just indicate that signals should be handled asap */
> + break;
> + case EXCP_DEBUG:
> + {
> + int sig;
> +
> + sig = gdb_handlesig (env, TARGET_SIGTRAP);
> + if (sig) {
> + info.si_signo = sig;
> + info.si_errno = 0;
> + info.si_code = TARGET_TRAP_BRKPT;
> + queue_signal(env, info.si_signo, &info);
> + }
> + }
> + break;
> + case EXCP_SVC:
> + {
> + int n = env->int_svc_code;
> + if (!n) {
> + /* syscalls > 255 */
> + n = env->regs[1];
> + }
> + env->psw.addr += env->int_svc_ilc;
> + env->regs[2] = do_syscall(env, n,
> + env->regs[2],
> + env->regs[3],
> + env->regs[4],
> + env->regs[5],
> + env->regs[6],
> + env->regs[7]);
> + }
> + break;
> + case EXCP_ADDR:
> + {
> + info.si_signo = SIGSEGV;
> + info.si_errno = 0;
> + /* XXX: check env->error_code */
> + info.si_code = TARGET_SEGV_MAPERR;
> + info._sifields._sigfault._addr = env->__excp_addr;
> + queue_signal(env, info.si_signo, &info);
> + }
> + break;
> + case EXCP_SPEC:
> + {
> + fprintf(stderr,"specification exception insn 0x%08x%04x\n", ldl(env->psw.addr), lduw(env->psw.addr + 4));
> + info.si_signo = SIGILL;
> + info.si_errno = 0;
> + info.si_code = TARGET_ILL_ILLOPC;
> + info._sifields._sigfault._addr = env->__excp_addr;
> + queue_signal(env, info.si_signo, &info);
> + }
> + break;
> + default:
> + printf ("Unhandled trap: 0x%x\n", trapnr);
> + cpu_dump_state(env, stderr, fprintf, 0);
> + exit (1);
> + }
> + process_pending_signals (env);
> + }
> +}
> +
> +#endif /* TARGET_S390X */
> +
> static void version(void)
> {
> printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
> @@ -3363,6 +3437,15 @@ int main(int argc, char **argv, char **envp)
> env->regs[15] = regs->acr;
> env->pc = regs->erp;
> }
> +#elif defined(TARGET_S390X)
> + {
> + int i;
> + for (i = 0; i < 16; i++) {
> + env->regs[i] = regs->gprs[i];
> + }
> + env->psw.mask = regs->psw.mask;
> + env->psw.addr = regs->psw.addr;
> + }
> #else
> #error unsupported target CPU
> #endif
> diff --git a/linux-user/s390x/syscall.h b/linux-user/s390x/syscall.h
> new file mode 100644
> index 0000000..a3812a8
> --- /dev/null
> +++ b/linux-user/s390x/syscall.h
> @@ -0,0 +1,25 @@
> +/* this typedef defines how a Program Status Word looks like */
> +typedef struct
> +{
> + abi_ulong mask;
> + abi_ulong addr;
> +} __attribute__ ((aligned(8))) target_psw_t;
> +
> +/*
> + * The pt_regs struct defines the way the registers are stored on
> + * the stack during a system call.
> + */
> +
> +#define TARGET_NUM_GPRS 16
> +
> +struct target_pt_regs
> +{
> + abi_ulong args[1];
> + target_psw_t psw;
> + abi_ulong gprs[TARGET_NUM_GPRS];
> + abi_ulong orig_gpr2;
> + unsigned short ilc;
> + unsigned short trap;
> +};
> +
> +#define UNAME_MACHINE "s390x"
> diff --git a/linux-user/s390x/syscall_nr.h b/linux-user/s390x/syscall_nr.h
> new file mode 100644
> index 0000000..7cc6db2
> --- /dev/null
> +++ b/linux-user/s390x/syscall_nr.h
> @@ -0,0 +1,349 @@
> +/*
> + * This file contains the system call numbers.
> + */
> +
> +#define TARGET_NR_exit 1
> +#define TARGET_NR_fork 2
> +#define TARGET_NR_read 3
> +#define TARGET_NR_write 4
> +#define TARGET_NR_open 5
> +#define TARGET_NR_close 6
> +#define TARGET_NR_restart_syscall 7
> +#define TARGET_NR_creat 8
> +#define TARGET_NR_link 9
> +#define TARGET_NR_unlink 10
> +#define TARGET_NR_execve 11
> +#define TARGET_NR_chdir 12
> +#define TARGET_NR_mknod 14
> +#define TARGET_NR_chmod 15
> +#define TARGET_NR_lseek 19
> +#define TARGET_NR_getpid 20
> +#define TARGET_NR_mount 21
> +#define TARGET_NR_umount 22
> +#define TARGET_NR_ptrace 26
> +#define TARGET_NR_alarm 27
> +#define TARGET_NR_pause 29
> +#define TARGET_NR_utime 30
> +#define TARGET_NR_access 33
> +#define TARGET_NR_nice 34
> +#define TARGET_NR_sync 36
> +#define TARGET_NR_kill 37
> +#define TARGET_NR_rename 38
> +#define TARGET_NR_mkdir 39
> +#define TARGET_NR_rmdir 40
> +#define TARGET_NR_dup 41
> +#define TARGET_NR_pipe 42
> +#define TARGET_NR_times 43
> +#define TARGET_NR_brk 45
> +#define TARGET_NR_signal 48
> +#define TARGET_NR_acct 51
> +#define TARGET_NR_umount2 52
> +#define TARGET_NR_ioctl 54
> +#define TARGET_NR_fcntl 55
> +#define TARGET_NR_setpgid 57
> +#define TARGET_NR_umask 60
> +#define TARGET_NR_chroot 61
> +#define TARGET_NR_ustat 62
> +#define TARGET_NR_dup2 63
> +#define TARGET_NR_getppid 64
> +#define TARGET_NR_getpgrp 65
> +#define TARGET_NR_setsid 66
> +#define TARGET_NR_sigaction 67
> +#define TARGET_NR_sigsuspend 72
> +#define TARGET_NR_sigpending 73
> +#define TARGET_NR_sethostname 74
> +#define TARGET_NR_setrlimit 75
> +#define TARGET_NR_getrusage 77
> +#define TARGET_NR_gettimeofday 78
> +#define TARGET_NR_settimeofday 79
> +#define TARGET_NR_symlink 83
> +#define TARGET_NR_readlink 85
> +#define TARGET_NR_uselib 86
> +#define TARGET_NR_swapon 87
> +#define TARGET_NR_reboot 88
> +#define TARGET_NR_readdir 89
> +#define TARGET_NR_mmap 90
> +#define TARGET_NR_munmap 91
> +#define TARGET_NR_truncate 92
> +#define TARGET_NR_ftruncate 93
> +#define TARGET_NR_fchmod 94
> +#define TARGET_NR_getpriority 96
> +#define TARGET_NR_setpriority 97
> +#define TARGET_NR_statfs 99
> +#define TARGET_NR_fstatfs 100
> +#define TARGET_NR_socketcall 102
> +#define TARGET_NR_syslog 103
> +#define TARGET_NR_setitimer 104
> +#define TARGET_NR_getitimer 105
> +#define TARGET_NR_stat 106
> +#define TARGET_NR_lstat 107
> +#define TARGET_NR_fstat 108
> +#define TARGET_NR_lookup_dcookie 110
> +#define TARGET_NR_vhangup 111
> +#define TARGET_NR_idle 112
> +#define TARGET_NR_wait4 114
> +#define TARGET_NR_swapoff 115
> +#define TARGET_NR_sysinfo 116
> +#define TARGET_NR_ipc 117
> +#define TARGET_NR_fsync 118
> +#define TARGET_NR_sigreturn 119
> +#define TARGET_NR_clone 120
> +#define TARGET_NR_setdomainname 121
> +#define TARGET_NR_uname 122
> +#define TARGET_NR_adjtimex 124
> +#define TARGET_NR_mprotect 125
> +#define TARGET_NR_sigprocmask 126
> +#define TARGET_NR_create_module 127
> +#define TARGET_NR_init_module 128
> +#define TARGET_NR_delete_module 129
> +#define TARGET_NR_get_kernel_syms 130
> +#define TARGET_NR_quotactl 131
> +#define TARGET_NR_getpgid 132
> +#define TARGET_NR_fchdir 133
> +#define TARGET_NR_bdflush 134
> +#define TARGET_NR_sysfs 135
> +#define TARGET_NR_personality 136
> +#define TARGET_NR_afs_syscall 137 /* Syscall for Andrew File System */
> +#define TARGET_NR_getdents 141
> +#define TARGET_NR_flock 143
> +#define TARGET_NR_msync 144
> +#define TARGET_NR_readv 145
> +#define TARGET_NR_writev 146
> +#define TARGET_NR_getsid 147
> +#define TARGET_NR_fdatasync 148
> +#define TARGET_NR__sysctl 149
> +#define TARGET_NR_mlock 150
> +#define TARGET_NR_munlock 151
> +#define TARGET_NR_mlockall 152
> +#define TARGET_NR_munlockall 153
> +#define TARGET_NR_sched_setparam 154
> +#define TARGET_NR_sched_getparam 155
> +#define TARGET_NR_sched_setscheduler 156
> +#define TARGET_NR_sched_getscheduler 157
> +#define TARGET_NR_sched_yield 158
> +#define TARGET_NR_sched_get_priority_max 159
> +#define TARGET_NR_sched_get_priority_min 160
> +#define TARGET_NR_sched_rr_get_interval 161
> +#define TARGET_NR_nanosleep 162
> +#define TARGET_NR_mremap 163
> +#define TARGET_NR_query_module 167
> +#define TARGET_NR_poll 168
> +#define TARGET_NR_nfsservctl 169
> +#define TARGET_NR_prctl 172
> +#define TARGET_NR_rt_sigreturn 173
> +#define TARGET_NR_rt_sigaction 174
> +#define TARGET_NR_rt_sigprocmask 175
> +#define TARGET_NR_rt_sigpending 176
> +#define TARGET_NR_rt_sigtimedwait 177
> +#define TARGET_NR_rt_sigqueueinfo 178
> +#define TARGET_NR_rt_sigsuspend 179
> +#define TARGET_NR_pread64 180
> +#define TARGET_NR_pwrite64 181
> +#define TARGET_NR_getcwd 183
> +#define TARGET_NR_capget 184
> +#define TARGET_NR_capset 185
> +#define TARGET_NR_sigaltstack 186
> +#define TARGET_NR_sendfile 187
> +#define TARGET_NR_getpmsg 188
> +#define TARGET_NR_putpmsg 189
> +#define TARGET_NR_vfork 190
> +#define TARGET_NR_pivot_root 217
> +#define TARGET_NR_mincore 218
> +#define TARGET_NR_madvise 219
> +#define TARGET_NR_getdents64 220
> +#define TARGET_NR_readahead 222
> +#define TARGET_NR_setxattr 224
> +#define TARGET_NR_lsetxattr 225
> +#define TARGET_NR_fsetxattr 226
> +#define TARGET_NR_getxattr 227
> +#define TARGET_NR_lgetxattr 228
> +#define TARGET_NR_fgetxattr 229
> +#define TARGET_NR_listxattr 230
> +#define TARGET_NR_llistxattr 231
> +#define TARGET_NR_flistxattr 232
> +#define TARGET_NR_removexattr 233
> +#define TARGET_NR_lremovexattr 234
> +#define TARGET_NR_fremovexattr 235
> +#define TARGET_NR_gettid 236
> +#define TARGET_NR_tkill 237
> +#define TARGET_NR_futex 238
> +#define TARGET_NR_sched_setaffinity 239
> +#define TARGET_NR_sched_getaffinity 240
> +#define TARGET_NR_tgkill 241
> +/* Number 242 is reserved for tux */
> +#define TARGET_NR_io_setup 243
> +#define TARGET_NR_io_destroy 244
> +#define TARGET_NR_io_getevents 245
> +#define TARGET_NR_io_submit 246
> +#define TARGET_NR_io_cancel 247
> +#define TARGET_NR_exit_group 248
> +#define TARGET_NR_epoll_create 249
> +#define TARGET_NR_epoll_ctl 250
> +#define TARGET_NR_epoll_wait 251
> +#define TARGET_NR_set_tid_address 252
> +#define TARGET_NR_fadvise64 253
> +#define TARGET_NR_timer_create 254
> +#define TARGET_NR_timer_settime (TARGET_NR_timer_create+1)
> +#define TARGET_NR_timer_gettime (TARGET_NR_timer_create+2)
> +#define TARGET_NR_timer_getoverrun (TARGET_NR_timer_create+3)
> +#define TARGET_NR_timer_delete (TARGET_NR_timer_create+4)
> +#define TARGET_NR_clock_settime (TARGET_NR_timer_create+5)
> +#define TARGET_NR_clock_gettime (TARGET_NR_timer_create+6)
> +#define TARGET_NR_clock_getres (TARGET_NR_timer_create+7)
> +#define TARGET_NR_clock_nanosleep (TARGET_NR_timer_create+8)
> +/* Number 263 is reserved for vserver */
> +#define TARGET_NR_statfs64 265
> +#define TARGET_NR_fstatfs64 266
> +#define TARGET_NR_remap_file_pages 267
> +/* Number 268 is reserved for new sys_mbind */
> +/* Number 269 is reserved for new sys_get_mempolicy */
> +/* Number 270 is reserved for new sys_set_mempolicy */
> +#define TARGET_NR_mq_open 271
> +#define TARGET_NR_mq_unlink 272
> +#define TARGET_NR_mq_timedsend 273
> +#define TARGET_NR_mq_timedreceive 274
> +#define TARGET_NR_mq_notify 275
> +#define TARGET_NR_mq_getsetattr 276
> +#define TARGET_NR_kexec_load 277
> +#define TARGET_NR_add_key 278
> +#define TARGET_NR_request_key 279
> +#define TARGET_NR_keyctl 280
> +#define TARGET_NR_waitid 281
> +#define TARGET_NR_ioprio_set 282
> +#define TARGET_NR_ioprio_get 283
> +#define TARGET_NR_inotify_init 284
> +#define TARGET_NR_inotify_add_watch 285
> +#define TARGET_NR_inotify_rm_watch 286
> +/* Number 287 is reserved for new sys_migrate_pages */
> +#define TARGET_NR_openat 288
> +#define TARGET_NR_mkdirat 289
> +#define TARGET_NR_mknodat 290
> +#define TARGET_NR_fchownat 291
> +#define TARGET_NR_futimesat 292
> +#define TARGET_NR_unlinkat 294
> +#define TARGET_NR_renameat 295
> +#define TARGET_NR_linkat 296
> +#define TARGET_NR_symlinkat 297
> +#define TARGET_NR_readlinkat 298
> +#define TARGET_NR_fchmodat 299
> +#define TARGET_NR_faccessat 300
> +#define TARGET_NR_pselect6 301
> +#define TARGET_NR_ppoll 302
> +#define TARGET_NR_unshare 303
> +#define TARGET_NR_set_robust_list 304
> +#define TARGET_NR_get_robust_list 305
> +#define TARGET_NR_splice 306
> +#define TARGET_NR_sync_file_range 307
> +#define TARGET_NR_tee 308
> +#define TARGET_NR_vmsplice 309
> +/* Number 310 is reserved for new sys_move_pages */
> +#define TARGET_NR_getcpu 311
> +#define TARGET_NR_epoll_pwait 312
> +#define TARGET_NR_utimes 313
> +#define TARGET_NR_fallocate 314
> +#define TARGET_NR_utimensat 315
> +#define TARGET_NR_signalfd 316
> +#define TARGET_NR_timerfd 317
> +#define TARGET_NR_eventfd 318
> +#define TARGET_NR_timerfd_create 319
> +#define TARGET_NR_timerfd_settime 320
> +#define TARGET_NR_timerfd_gettime 321
> +#define TARGET_NR_signalfd4 322
> +#define TARGET_NR_eventfd2 323
> +#define TARGET_NR_inotify_init1 324
> +#define TARGET_NR_pipe2 325
> +#define TARGET_NR_dup3 326
> +#define TARGET_NR_epoll_create1 327
> +#undef NR_syscalls
> +#define NR_syscalls 328
> +
> +/*
> + * There are some system calls that are not present on 64 bit, some
> + * have a different name although they do the same (e.g. TARGET_NR_chown32
> + * is TARGET_NR_chown on 64 bit).
> + */
> +#ifndef TARGET_S390X
> +
> +#define TARGET_NR_time 13
> +#define TARGET_NR_lchown 16
> +#define TARGET_NR_setuid 23
> +#define TARGET_NR_getuid 24
> +#define TARGET_NR_stime 25
> +#define TARGET_NR_setgid 46
> +#define TARGET_NR_getgid 47
> +#define TARGET_NR_geteuid 49
> +#define TARGET_NR_getegid 50
> +#define TARGET_NR_setreuid 70
> +#define TARGET_NR_setregid 71
> +#define TARGET_NR_getrlimit 76
> +#define TARGET_NR_getgroups 80
> +#define TARGET_NR_setgroups 81
> +#define TARGET_NR_fchown 95
> +#define TARGET_NR_ioperm 101
> +#define TARGET_NR_setfsuid 138
> +#define TARGET_NR_setfsgid 139
> +#define TARGET_NR__llseek 140
> +#define TARGET_NR__newselect 142
> +#define TARGET_NR_setresuid 164
> +#define TARGET_NR_getresuid 165
> +#define TARGET_NR_setresgid 170
> +#define TARGET_NR_getresgid 171
> +#define TARGET_NR_chown 182
> +#define TARGET_NR_ugetrlimit 191 /* SuS compliant getrlimit */
> +#define TARGET_NR_mmap2 192
> +#define TARGET_NR_truncate64 193
> +#define TARGET_NR_ftruncate64 194
> +#define TARGET_NR_stat64 195
> +#define TARGET_NR_lstat64 196
> +#define TARGET_NR_fstat64 197
> +#define TARGET_NR_lchown32 198
> +#define TARGET_NR_getuid32 199
> +#define TARGET_NR_getgid32 200
> +#define TARGET_NR_geteuid32 201
> +#define TARGET_NR_getegid32 202
> +#define TARGET_NR_setreuid32 203
> +#define TARGET_NR_setregid32 204
> +#define TARGET_NR_getgroups32 205
> +#define TARGET_NR_setgroups32 206
> +#define TARGET_NR_fchown32 207
> +#define TARGET_NR_setresuid32 208
> +#define TARGET_NR_getresuid32 209
> +#define TARGET_NR_setresgid32 210
> +#define TARGET_NR_getresgid32 211
> +#define TARGET_NR_chown32 212
> +#define TARGET_NR_setuid32 213
> +#define TARGET_NR_setgid32 214
> +#define TARGET_NR_setfsuid32 215
> +#define TARGET_NR_setfsgid32 216
> +#define TARGET_NR_fcntl64 221
> +#define TARGET_NR_sendfile64 223
> +#define TARGET_NR_fadvise64_64 264
> +#define TARGET_NR_fstatat64 293
> +
> +#else
> +
> +#define TARGET_NR_select 142
> +#define TARGET_NR_getrlimit 191 /* SuS compliant getrlimit */
> +#define TARGET_NR_lchown 198
> +#define TARGET_NR_getuid 199
> +#define TARGET_NR_getgid 200
> +#define TARGET_NR_geteuid 201
> +#define TARGET_NR_getegid 202
> +#define TARGET_NR_setreuid 203
> +#define TARGET_NR_setregid 204
> +#define TARGET_NR_getgroups 205
> +#define TARGET_NR_setgroups 206
> +#define TARGET_NR_fchown 207
> +#define TARGET_NR_setresuid 208
> +#define TARGET_NR_getresuid 209
> +#define TARGET_NR_setresgid 210
> +#define TARGET_NR_getresgid 211
> +#define TARGET_NR_chown 212
> +#define TARGET_NR_setuid 213
> +#define TARGET_NR_setgid 214
> +#define TARGET_NR_setfsuid 215
> +#define TARGET_NR_setfsgid 216
> +#define TARGET_NR_newfstatat 293
> +
> +#endif
> +
> diff --git a/linux-user/s390x/target_signal.h b/linux-user/s390x/target_signal.h
> new file mode 100644
> index 0000000..b4816b0
> --- /dev/null
> +++ b/linux-user/s390x/target_signal.h
> @@ -0,0 +1,26 @@
> +#ifndef TARGET_SIGNAL_H
> +#define TARGET_SIGNAL_H
> +
> +#include "cpu.h"
> +
> +typedef struct target_sigaltstack {
> + abi_ulong ss_sp;
> + int ss_flags;
> + abi_ulong ss_size;
> +} target_stack_t;
> +
> +/*
> + * sigaltstack controls
> + */
> +#define TARGET_SS_ONSTACK 1
> +#define TARGET_SS_DISABLE 2
> +
> +#define TARGET_MINSIGSTKSZ 2048
> +#define TARGET_SIGSTKSZ 8192
> +
> +static inline abi_ulong get_sp_from_cpustate(CPUS390XState *state)
> +{
> + return state->regs[15];
> +}
> +
> +#endif /* TARGET_SIGNAL_H */
> diff --git a/linux-user/s390x/termbits.h b/linux-user/s390x/termbits.h
> new file mode 100644
> index 0000000..2a78a05
> --- /dev/null
> +++ b/linux-user/s390x/termbits.h
> @@ -0,0 +1,283 @@
> +/*
> + * include/asm-s390/termbits.h
> + *
> + * S390 version
> + *
> + * Derived from "include/asm-i386/termbits.h"
> + */
> +
> +#define TARGET_NCCS 19
> +struct target_termios {
> + unsigned int c_iflag; /* input mode flags */
> + unsigned int c_oflag; /* output mode flags */
> + unsigned int c_cflag; /* control mode flags */
> + unsigned int c_lflag; /* local mode flags */
> + unsigned char c_line; /* line discipline */
> + unsigned char c_cc[TARGET_NCCS]; /* control characters */
> +};
> +
> +struct target_termios2 {
> + unsigned int c_iflag; /* input mode flags */
> + unsigned int c_oflag; /* output mode flags */
> + unsigned int c_cflag; /* control mode flags */
> + unsigned int c_lflag; /* local mode flags */
> + unsigned char c_line; /* line discipline */
> + unsigned char c_cc[TARGET_NCCS]; /* control characters */
> + unsigned int c_ispeed; /* input speed */
> + unsigned int c_ospeed; /* output speed */
> +};
> +
> +struct target_ktermios {
> + unsigned int c_iflag; /* input mode flags */
> + unsigned int c_oflag; /* output mode flags */
> + unsigned int c_cflag; /* control mode flags */
> + unsigned int c_lflag; /* local mode flags */
> + unsigned char c_line; /* line discipline */
> + unsigned char c_cc[TARGET_NCCS]; /* control characters */
> + unsigned int c_ispeed; /* input speed */
> + unsigned int c_ospeed; /* output speed */
> +};
> +
> +/* c_cc characters */
> +#define TARGET_VINTR 0
> +#define TARGET_VQUIT 1
> +#define TARGET_VERASE 2
> +#define TARGET_VKILL 3
> +#define TARGET_VEOF 4
> +#define TARGET_VTIME 5
> +#define TARGET_VMIN 6
> +#define TARGET_VSWTC 7
> +#define TARGET_VSTART 8
> +#define TARGET_VSTOP 9
> +#define TARGET_VSUSP 10
> +#define TARGET_VEOL 11
> +#define TARGET_VREPRINT 12
> +#define TARGET_VDISCARD 13
> +#define TARGET_VWERASE 14
> +#define TARGET_VLNEXT 15
> +#define TARGET_VEOL2 16
> +
> +/* c_iflag bits */
> +#define TARGET_IGNBRK 0000001
> +#define TARGET_BRKINT 0000002
> +#define TARGET_IGNPAR 0000004
> +#define TARGET_PARMRK 0000010
> +#define TARGET_INPCK 0000020
> +#define TARGET_ISTRIP 0000040
> +#define TARGET_INLCR 0000100
> +#define TARGET_IGNCR 0000200
> +#define TARGET_ICRNL 0000400
> +#define TARGET_IUCLC 0001000
> +#define TARGET_IXON 0002000
> +#define TARGET_IXANY 0004000
> +#define TARGET_IXOFF 0010000
> +#define TARGET_IMAXBEL 0020000
> +#define TARGET_IUTF8 0040000
> +
> +/* c_oflag bits */
> +#define TARGET_OPOST 0000001
> +#define TARGET_OLCUC 0000002
> +#define TARGET_ONLCR 0000004
> +#define TARGET_OCRNL 0000010
> +#define TARGET_ONOCR 0000020
> +#define TARGET_ONLRET 0000040
> +#define TARGET_OFILL 0000100
> +#define TARGET_OFDEL 0000200
> +#define TARGET_NLDLY 0000400
> +#define TARGET_NL0 0000000
> +#define TARGET_NL1 0000400
> +#define TARGET_CRDLY 0003000
> +#define TARGET_CR0 0000000
> +#define TARGET_CR1 0001000
> +#define TARGET_CR2 0002000
> +#define TARGET_CR3 0003000
> +#define TARGET_TABDLY 0014000
> +#define TARGET_TAB0 0000000
> +#define TARGET_TAB1 0004000
> +#define TARGET_TAB2 0010000
> +#define TARGET_TAB3 0014000
> +#define TARGET_XTABS 0014000
> +#define TARGET_BSDLY 0020000
> +#define TARGET_BS0 0000000
> +#define TARGET_BS1 0020000
> +#define TARGET_VTDLY 0040000
> +#define TARGET_VT0 0000000
> +#define TARGET_VT1 0040000
> +#define TARGET_FFDLY 0100000
> +#define TARGET_FF0 0000000
> +#define TARGET_FF1 0100000
> +
> +/* c_cflag bit meaning */
> +#define TARGET_CBAUD 0010017
> +#define TARGET_B0 0000000 /* hang up */
> +#define TARGET_B50 0000001
> +#define TARGET_B75 0000002
> +#define TARGET_B110 0000003
> +#define TARGET_B134 0000004
> +#define TARGET_B150 0000005
> +#define TARGET_B200 0000006
> +#define TARGET_B300 0000007
> +#define TARGET_B600 0000010
> +#define TARGET_B1200 0000011
> +#define TARGET_B1800 0000012
> +#define TARGET_B2400 0000013
> +#define TARGET_B4800 0000014
> +#define TARGET_B9600 0000015
> +#define TARGET_B19200 0000016
> +#define TARGET_B38400 0000017
> +#define TARGET_EXTA B19200
> +#define TARGET_EXTB B38400
> +#define TARGET_CSIZE 0000060
> +#define TARGET_CS5 0000000
> +#define TARGET_CS6 0000020
> +#define TARGET_CS7 0000040
> +#define TARGET_CS8 0000060
> +#define TARGET_CSTOPB 0000100
> +#define TARGET_CREAD 0000200
> +#define TARGET_PARENB 0000400
> +#define TARGET_PARODD 0001000
> +#define TARGET_HUPCL 0002000
> +#define TARGET_CLOCAL 0004000
> +#define TARGET_CBAUDEX 0010000
> +#define TARGET_BOTHER 0010000
> +#define TARGET_B57600 0010001
> +#define TARGET_B115200 0010002
> +#define TARGET_B230400 0010003
> +#define TARGET_B460800 0010004
> +#define TARGET_B500000 0010005
> +#define TARGET_B576000 0010006
> +#define TARGET_B921600 0010007
> +#define TARGET_B1000000 0010010
> +#define TARGET_B1152000 0010011
> +#define TARGET_B1500000 0010012
> +#define TARGET_B2000000 0010013
> +#define TARGET_B2500000 0010014
> +#define TARGET_B3000000 0010015
> +#define TARGET_B3500000 0010016
> +#define TARGET_B4000000 0010017
> +#define TARGET_CIBAUD 002003600000 /* input baud rate */
> +#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
> +#define TARGET_CRTSCTS 020000000000 /* flow control */
> +
> +#define TARGET_IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
> +
> +/* c_lflag bits */
> +#define TARGET_ISIG 0000001
> +#define TARGET_ICANON 0000002
> +#define TARGET_XCASE 0000004
> +#define TARGET_ECHO 0000010
> +#define TARGET_ECHOE 0000020
> +#define TARGET_ECHOK 0000040
> +#define TARGET_ECHONL 0000100
> +#define TARGET_NOFLSH 0000200
> +#define TARGET_TOSTOP 0000400
> +#define TARGET_ECHOCTL 0001000
> +#define TARGET_ECHOPRT 0002000
> +#define TARGET_ECHOKE 0004000
> +#define TARGET_FLUSHO 0010000
> +#define TARGET_PENDIN 0040000
> +#define TARGET_IEXTEN 0100000
> +
> +/* tcflow() and TCXONC use these */
> +#define TARGET_TCOOFF 0
> +#define TARGET_TCOON 1
> +#define TARGET_TCIOFF 2
> +#define TARGET_TCION 3
> +
> +/* tcflush() and TCFLSH use these */
> +#define TARGET_TCIFLUSH 0
> +#define TARGET_TCOFLUSH 1
> +#define TARGET_TCIOFLUSH 2
> +
> +/* tcsetattr uses these */
> +#define TARGET_TCSANOW 0
> +#define TARGET_TCSADRAIN 1
> +#define TARGET_TCSAFLUSH 2
> +
> +/*
> + * include/asm-s390/ioctls.h
> + *
> + * S390 version
> + *
> + * Derived from "include/asm-i386/ioctls.h"
> + */
> +
> +/* 0x54 is just a magic number to make these relatively unique ('T') */
> +
> +#define TARGET_TCGETS 0x5401
> +#define TARGET_TCSETS 0x5402
> +#define TARGET_TCSETSW 0x5403
> +#define TARGET_TCSETSF 0x5404
> +#define TARGET_TCGETA 0x5405
> +#define TARGET_TCSETA 0x5406
> +#define TARGET_TCSETAW 0x5407
> +#define TARGET_TCSETAF 0x5408
> +#define TARGET_TCSBRK 0x5409
> +#define TARGET_TCXONC 0x540A
> +#define TARGET_TCFLSH 0x540B
> +#define TARGET_TIOCEXCL 0x540C
> +#define TARGET_TIOCNXCL 0x540D
> +#define TARGET_TIOCSCTTY 0x540E
> +#define TARGET_TIOCGPGRP 0x540F
> +#define TARGET_TIOCSPGRP 0x5410
> +#define TARGET_TIOCOUTQ 0x5411
> +#define TARGET_TIOCSTI 0x5412
> +#define TARGET_TIOCGWINSZ 0x5413
> +#define TARGET_TIOCSWINSZ 0x5414
> +#define TARGET_TIOCMGET 0x5415
> +#define TARGET_TIOCMBIS 0x5416
> +#define TARGET_TIOCMBIC 0x5417
> +#define TARGET_TIOCMSET 0x5418
> +#define TARGET_TIOCGSOFTCAR 0x5419
> +#define TARGET_TIOCSSOFTCAR 0x541A
> +#define TARGET_FIONREAD 0x541B
> +#define TARGET_TIOCINQ FIONREAD
> +#define TARGET_TIOCLINUX 0x541C
> +#define TARGET_TIOCCONS 0x541D
> +#define TARGET_TIOCGSERIAL 0x541E
> +#define TARGET_TIOCSSERIAL 0x541F
> +#define TARGET_TIOCPKT 0x5420
> +#define TARGET_FIONBIO 0x5421
> +#define TARGET_TIOCNOTTY 0x5422
> +#define TARGET_TIOCSETD 0x5423
> +#define TARGET_TIOCGETD 0x5424
> +#define TARGET_TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
> +#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
> +#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
> +#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
> +#define TARGET_TCGETS2 _IOR('T',0x2A, struct termios2)
> +#define TARGET_TCSETS2 _IOW('T',0x2B, struct termios2)
> +#define TARGET_TCSETSW2 _IOW('T',0x2C, struct termios2)
> +#define TARGET_TCSETSF2 _IOW('T',0x2D, struct termios2)
> +#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> +#define TARGET_TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
> +#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
> +
> +#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
> +#define TARGET_FIOCLEX 0x5451
> +#define TARGET_FIOASYNC 0x5452
> +#define TARGET_TIOCSERCONFIG 0x5453
> +#define TARGET_TIOCSERGWILD 0x5454
> +#define TARGET_TIOCSERSWILD 0x5455
> +#define TARGET_TIOCGLCKTRMIOS 0x5456
> +#define TARGET_TIOCSLCKTRMIOS 0x5457
> +#define TARGET_TIOCSERGSTRUCT 0x5458 /* For debugging only */
> +#define TARGET_TIOCSERGETLSR 0x5459 /* Get line status register */
> +#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config */
> +#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
> +
> +#define TARGET_TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
> +#define TARGET_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
> +#define TARGET_FIOQSIZE 0x545E
> +
> +/* Used for packet mode */
> +#define TARGET_TIOCPKT_DATA 0
> +#define TARGET_TIOCPKT_FLUSHREAD 1
> +#define TARGET_TIOCPKT_FLUSHWRITE 2
> +#define TARGET_TIOCPKT_STOP 4
> +#define TARGET_TIOCPKT_START 8
> +#define TARGET_TIOCPKT_NOSTOP 16
> +#define TARGET_TIOCPKT_DOSTOP 32
> +
> +#define TARGET_TIOCSER_TEMT 0x01 /* Transmitter physically empty */
> +
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index ce033e9..8cdd22d 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -3614,6 +3614,320 @@ long do_rt_sigreturn(CPUState *env)
> return -TARGET_ENOSYS;
> }
>
> +#elif defined(TARGET_S390X)
> +
> +#define __NUM_GPRS 16
> +#define __NUM_FPRS 16
> +#define __NUM_ACRS 16
> +
> +#define S390_SYSCALL_SIZE 2
> +#define __SIGNAL_FRAMESIZE 160 /* FIXME: 31-bit mode -> 96 */
> +
> +#define _SIGCONTEXT_NSIG 64
> +#define _SIGCONTEXT_NSIG_BPW 64 /* FIXME: 31-bit mode -> 32 */
> +#define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
> +#define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
> +#define PSW_ADDR_AMODE 0x0000000000000000UL /* 0x80000000UL for 31-bit */
> +#define S390_SYSCALL_OPCODE ((uint16_t)0x0a00)
> +
> +typedef struct
> +{
> + target_psw_t psw;
> + target_ulong gprs[__NUM_GPRS];
> + unsigned int acrs[__NUM_ACRS];
> +} target_s390_regs_common;
> +
> +typedef struct
> +{
> + unsigned int fpc;
> + double fprs[__NUM_FPRS];
> +} target_s390_fp_regs;
> +
> +typedef struct
> +{
> + target_s390_regs_common regs;
> + target_s390_fp_regs fpregs;
> +} target_sigregs;
> +
> +struct target_sigcontext
> +{
> + target_ulong oldmask[_SIGCONTEXT_NSIG_WORDS];
> + target_sigregs *sregs;
> +};
> +
> +typedef struct
> +{
> + uint8_t callee_used_stack[__SIGNAL_FRAMESIZE];
> + struct target_sigcontext sc;
> + target_sigregs sregs;
> + int signo;
> + uint8_t retcode[S390_SYSCALL_SIZE];
> +} sigframe;
> +
> +struct target_ucontext {
> + target_ulong uc_flags;
> + struct target_ucontext *uc_link;
> + target_stack_t uc_stack;
> + target_sigregs uc_mcontext;
> + target_sigset_t uc_sigmask; /* mask last for extensibility */
> +};
> +
> +typedef struct
> +{
> + uint8_t callee_used_stack[__SIGNAL_FRAMESIZE];
> + uint8_t retcode[S390_SYSCALL_SIZE];
> + struct target_siginfo info;
> + struct target_ucontext uc;
> +} rt_sigframe;
> +
> +static inline abi_ulong
> +get_sigframe(struct target_sigaction *ka, CPUState *env, size_t frame_size)
> +{
> + abi_ulong sp;
> +
> + /* Default to using normal stack */
> + sp = env->regs[15];
> +
> + /* This is the X/Open sanctioned signal stack switching. */
> + if (ka->sa_flags & TARGET_SA_ONSTACK) {
> + if (! sas_ss_flags(sp))
> + sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
> + }
> +
> + /* This is the legacy signal stack switching. */
> + else if (/* FIXME !user_mode(regs) */ 0 &&
> + !(ka->sa_flags & TARGET_SA_RESTORER) &&
> + ka->sa_restorer) {
> + sp = (abi_ulong) ka->sa_restorer;
> + }
> +
> + return (sp - frame_size) & -8ul;
> +}
> +
> +static void save_sigregs(CPUState *env, target_sigregs *sregs)
> +{
> + int i;
> + //save_access_regs(current->thread.acrs); FIXME
> +
> + /* Copy a 'clean' PSW mask to the user to avoid leaking
> + information about whether PER is currently on. */
> + __put_user(env->psw.mask, &sregs->regs.psw.mask);
> + __put_user(env->psw.addr, &sregs->regs.psw.addr);
> + for (i = 0; i < 16; i++)
> + __put_user(env->regs[i], &sregs->regs.gprs[i]);
> + for (i = 0; i < 16; i++)
> + __put_user(env->aregs[i], &sregs->regs.acrs[i]);
> + /*
CODING_STYLE there, and later in this file. It might be a good idea
to run checkpatch.pl on this patch.
> + * We have to store the fp registers to current->thread.fp_regs
> + * to merge them with the emulated registers.
> + */
> + //save_fp_regs(¤t->thread.fp_regs); FIXME
> + for (i = 0; i < 16; i++)
> + __put_user(env->fregs[i].ll, &sregs->fpregs.fprs[i]);
> +}
> +
> +static void setup_frame(int sig, struct target_sigaction *ka,
> + target_sigset_t *set, CPUState *env)
> +{
> + sigframe *frame;
> + abi_ulong frame_addr;
> +
> + frame_addr = get_sigframe(ka, env, sizeof *frame);
> + qemu_log("%s: frame_addr 0x%lx\n", __FUNCTION__, frame_addr);
> + if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
> + goto give_sigsegv;
> +
> + qemu_log("%s: 1\n", __FUNCTION__);
> + if (__put_user(set->sig[0], &frame->sc.oldmask[0]))
> + goto give_sigsegv;
> +
> + save_sigregs(env, &frame->sregs);
> +
> + __put_user((abi_ulong)&frame->sregs, (abi_ulong *)&frame->sc.sregs);
> +
> + /* Set up to return from userspace. If provided, use a stub
> + already in userspace. */
> + if (ka->sa_flags & TARGET_SA_RESTORER) {
> + env->regs[14] = (unsigned long)
> + ka->sa_restorer | PSW_ADDR_AMODE;
> + } else {
> + env->regs[14] = (unsigned long)
> + frame->retcode | PSW_ADDR_AMODE;
> + if (__put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn,
> + (uint16_t *)(frame->retcode)))
> + goto give_sigsegv;
> + }
> +
> + /* Set up backchain. */
> + if (__put_user(env->regs[15], (abi_ulong *) frame))
> + goto give_sigsegv;
> +
> + /* Set up registers for signal handler */
> + env->regs[15] = (target_ulong) frame;
> + env->psw.addr = (target_ulong) ka->_sa_handler | PSW_ADDR_AMODE;
> +
> + env->regs[2] = sig; //map_signal(sig);
> + env->regs[3] = (target_ulong) &frame->sc;
> +
> + /* We forgot to include these in the sigcontext.
> + To avoid breaking binary compatibility, they are passed as args. */
> + env->regs[4] = 0; // FIXME: no clue... current->thread.trap_no;
> + env->regs[5] = 0; // FIXME: no clue... current->thread.prot_addr;
> +
> + /* Place signal number on stack to allow backtrace from handler. */
> + if (__put_user(env->regs[2], (int *) &frame->signo))
> + goto give_sigsegv;
> + unlock_user_struct(frame, frame_addr, 1);
> + return;
> +
> +give_sigsegv:
> + qemu_log("%s: give_sigsegv\n", __FUNCTION__);
> + unlock_user_struct(frame, frame_addr, 1);
> + force_sig(TARGET_SIGSEGV);
> +}
> +
> +static void setup_rt_frame(int sig, struct target_sigaction *ka,
> + target_siginfo_t *info,
> + target_sigset_t *set, CPUState *env)
> +{
> + int i;
> + rt_sigframe *frame;
> + abi_ulong frame_addr;
> +
> + frame_addr = get_sigframe(ka, env, sizeof *frame);
> + qemu_log("%s: frame_addr 0x%lx\n", __FUNCTION__, frame_addr);
> + if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
> + goto give_sigsegv;
> +
> + qemu_log("%s: 1\n", __FUNCTION__);
> + if (copy_siginfo_to_user(&frame->info, info))
> + goto give_sigsegv;
> +
> + /* Create the ucontext. */
> + __put_user(0, &frame->uc.uc_flags);
> + __put_user((abi_ulong)NULL, (abi_ulong*)&frame->uc.uc_link);
> + __put_user(target_sigaltstack_used.ss_sp, &frame->uc.uc_stack.ss_sp);
> + __put_user(sas_ss_flags(get_sp_from_cpustate(env)),
> + &frame->uc.uc_stack.ss_flags);
> + __put_user(target_sigaltstack_used.ss_size, &frame->uc.uc_stack.ss_size);
> + save_sigregs(env, &frame->uc.uc_mcontext);
> + for(i = 0; i < TARGET_NSIG_WORDS; i++) {
> + __put_user((abi_ulong)set->sig[i], (abi_ulong*)&frame->uc.uc_sigmask.sig[i]);
> + }
> +
> + /* Set up to return from userspace. If provided, use a stub
> + already in userspace. */
> + if (ka->sa_flags & TARGET_SA_RESTORER) {
> + env->regs[14] = (unsigned long)
> + ka->sa_restorer | PSW_ADDR_AMODE;
> + } else {
> + env->regs[14] = (unsigned long)
> + frame->retcode | PSW_ADDR_AMODE;
> + if (__put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn,
> + (uint16_t *)(frame->retcode)))
> + goto give_sigsegv;
> + }
> +
> + /* Set up backchain. */
> + if (__put_user(env->regs[15], (abi_ulong *) frame))
> + goto give_sigsegv;
> +
> + /* Set up registers for signal handler */
> + env->regs[15] = (target_ulong) frame;
> + env->psw.addr = (target_ulong) ka->_sa_handler | PSW_ADDR_AMODE;
> +
> + env->regs[2] = sig; //map_signal(sig);
> + env->regs[3] = (target_ulong) &frame->info;
> + env->regs[4] = (target_ulong) &frame->uc;
> + return;
> +
> +give_sigsegv:
> + qemu_log("%s: give_sigsegv\n", __FUNCTION__);
> + unlock_user_struct(frame, frame_addr, 1);
> + force_sig(TARGET_SIGSEGV);
> +}
> +
> +static int
> +restore_sigregs(CPUState *env, target_sigregs *sc)
> +{
> + int err = 0;
> + int i;
> +
> + for (i = 0; i < 16; i++) {
> + err |= __get_user(env->regs[i], &sc->regs.gprs[i]);
> + }
> +
> + err |= __get_user(env->psw.mask, &sc->regs.psw.mask);
> + qemu_log("%s: sc->regs.psw.addr 0x%lx env->psw.addr 0x%lx\n", __FUNCTION__, sc->regs.psw.addr, env->psw.addr);
> + err |= __get_user(env->psw.addr, &sc->regs.psw.addr);
> + /* FIXME: 31-bit -> | PSW_ADDR_AMODE */
> +
> + for (i = 0; i < 16; i++) {
> + err |= __get_user(env->aregs[i], &sc->regs.acrs[i]);
> + }
> + for (i = 0; i < 16; i++) {
> + err |= __get_user(env->fregs[i].ll, &sc->fpregs.fprs[i]);
> + }
> +
> + return err;
> +}
> +
> +long do_sigreturn(CPUState *env)
> +{
> + sigframe *frame;
> + abi_ulong frame_addr = env->regs[15];
> + qemu_log("%s: frame_addr 0x%lx\n", __FUNCTION__, frame_addr);
> + target_sigset_t target_set;
> + sigset_t set;
> +
> + if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1))
> + goto badframe;
> + if (__get_user(target_set.sig[0], &frame->sc.oldmask[0]))
> + goto badframe;
> +
> + target_to_host_sigset_internal(&set, &target_set);
> + sigprocmask(SIG_SETMASK, &set, NULL); /* ~_BLOCKABLE? */
> +
> + if (restore_sigregs(env, &frame->sregs))
> + goto badframe;
> +
> + unlock_user_struct(frame, frame_addr, 0);
> + return env->regs[2];
> +
> +badframe:
> + unlock_user_struct(frame, frame_addr, 0);
> + force_sig(TARGET_SIGSEGV);
> + return 0;
> +}
> +
> +long do_rt_sigreturn(CPUState *env)
> +{
> + rt_sigframe *frame;
> + abi_ulong frame_addr = env->regs[15];
> + qemu_log("%s: frame_addr 0x%lx\n", __FUNCTION__, frame_addr);
> + sigset_t set;
> +
> + if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1))
> + goto badframe;
> + target_to_host_sigset(&set, &frame->uc.uc_sigmask);
> +
> + sigprocmask(SIG_SETMASK, &set, NULL); /* ~_BLOCKABLE? */
> +
> + if (restore_sigregs(env, &frame->uc.uc_mcontext))
> + goto badframe;
> +
> + if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.uc_stack), 0,
> + get_sp_from_cpustate(env)) == -EFAULT)
> + goto badframe;
> + unlock_user_struct(frame, frame_addr, 0);
> + return env->regs[2];
> +
> +badframe:
> + unlock_user_struct(frame, frame_addr, 0);
> + force_sig(TARGET_SIGSEGV);
> + return 0;
> +}
> +
> #elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
>
> /* FIXME: Many of the structures are defined for both PPC and PPC64, but
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index bb0999d..fabe815 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -196,7 +196,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
> #define __NR_sys_inotify_add_watch __NR_inotify_add_watch
> #define __NR_sys_inotify_rm_watch __NR_inotify_rm_watch
>
> -#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
> +#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) || defined(__s390x__)
> #define __NR__llseek __NR_lseek
> #endif
That's probably a correct change, but it should be done in a separate
patch as it concerns host support.
> @@ -5432,7 +5432,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> ret = get_errno(settimeofday(&tv, NULL));
> }
> break;
> -#ifdef TARGET_NR_select
> +#if defined(TARGET_NR_select) && !defined(TARGET_S390X) && !defined(TARGET_S390)
> case TARGET_NR_select:
> {
> struct target_sel_arg_struct *sel;
> @@ -5543,7 +5543,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> #endif
> #ifdef TARGET_NR_mmap
> case TARGET_NR_mmap:
> -#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE)
> +#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || \
> + defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE) \
> + || defined(TARGET_S390X)
> {
> abi_ulong *v;
> abi_ulong v1, v2, v3, v4, v5, v6;
> @@ -6039,6 +6041,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4));
> #elif defined(TARGET_CRIS)
> ret = get_errno(do_fork(cpu_env, arg2, arg1, arg3, arg4, arg5));
> +#elif defined(TARGET_S390X)
> + ret = get_errno(do_fork(cpu_env, arg2, arg1, arg3, arg5, arg4));
> #else
> ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5));
> #endif
> @@ -6247,8 +6251,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> }
> break;
> #endif /* TARGET_NR_getdents64 */
> -#ifdef TARGET_NR__newselect
> +#if defined(TARGET_NR__newselect) || defined(TARGET_S390X)
> +#ifdef TARGET_S390X
> + case TARGET_NR_select:
> +#else
> case TARGET_NR__newselect:
> +#endif
> ret = do_select(arg1, arg2, arg3, arg4, arg5);
> break;
> #endif
> @@ -6576,7 +6584,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> case TARGET_NR_sigaltstack:
> #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_MIPS) || \
> defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
> - defined(TARGET_M68K)
> + defined(TARGET_M68K) || defined(TARGET_S390X)
> ret = do_sigaltstack(arg1, arg2, get_sp_from_cpustate((CPUState *)cpu_env));
> break;
> #else
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 702652c..7a870ac 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -55,7 +55,7 @@
> #endif
>
> #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
> - || defined(TARGET_M68K) || defined(TARGET_CRIS)
> + || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_S390X)
>
> #define TARGET_IOC_SIZEBITS 14
> #define TARGET_IOC_DIRBITS 2
> @@ -315,7 +315,10 @@ struct target_sigaction;
> int do_sigaction(int sig, const struct target_sigaction *act,
> struct target_sigaction *oact);
>
> -#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE)
> +#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || \
> + defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || \
> + defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \
> + defined(TARGET_MICROBLAZE) || defined(TARGET_S390X)
>
> #if defined(TARGET_SPARC)
> #define TARGET_SA_NOCLDSTOP 8u
> @@ -1678,6 +1681,27 @@ struct target_stat {
>
> abi_long __unused[3];
> };
> +#elif defined(TARGET_S390X)
> +struct target_stat {
> + abi_ulong st_dev;
> + abi_ulong st_ino;
> + abi_ulong st_nlink;
> + unsigned int st_mode;
> + unsigned int st_uid;
> + unsigned int st_gid;
> + unsigned int __pad1;
> + abi_ulong st_rdev;
> + abi_ulong st_size;
> + abi_ulong target_st_atime;
> + abi_ulong target_st_atime_nsec;
> + abi_ulong target_st_mtime;
> + abi_ulong target_st_mtime_nsec;
> + abi_ulong target_st_ctime;
> + abi_ulong target_st_ctime_nsec;
> + abi_ulong st_blksize;
> + abi_long st_blocks;
> + abi_ulong __unused[3];
> +};
> #else
> #error unsupported CPU
> #endif
> @@ -1764,6 +1788,34 @@ struct target_statfs64 {
> abi_long f_frsize;
> abi_long f_spare[5];
> };
> +#elif defined(TARGET_S390X)
> +struct target_statfs {
> + int32_t f_type;
> + int32_t f_bsize;
> + abi_long f_blocks;
> + abi_long f_bfree;
> + abi_long f_bavail;
> + abi_long f_files;
> + abi_long f_ffree;
> + kernel_fsid_t f_fsid;
> + int32_t f_namelen;
> + int32_t f_frsize;
> + int32_t f_spare[5];
> +};
> +
> +struct target_statfs64 {
> + int32_t f_type;
> + int32_t f_bsize;
> + abi_long f_blocks;
> + abi_long f_bfree;
> + abi_long f_bavail;
> + abi_long f_files;
> + abi_long f_ffree;
> + kernel_fsid_t f_fsid;
> + int32_t f_namelen;
> + int32_t f_frsize;
> + int32_t f_spare[5];
> +};
> #else
> struct target_statfs {
> uint32_t f_type;
> diff --git a/s390x.ld b/s390x.ld
> new file mode 100644
> index 0000000..7d1f2b7
> --- /dev/null
> +++ b/s390x.ld
> @@ -0,0 +1,194 @@
> +/* Default linker script, for normal executables */
> +OUTPUT_FORMAT("elf64-s390", "elf64-s390",
> + "elf64-s390")
> +OUTPUT_ARCH(s390:64-bit)
> +ENTRY(_start)
> +SEARCH_DIR("/usr/s390x-suse-linux/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/s390x-suse-linux/lib"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
> +SECTIONS
> +{
> + /* Read-only sections, merged into text segment: */
> + PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS;
> + .interp : { *(.interp) }
> + .note.gnu.build-id : { *(.note.gnu.build-id) }
> + .hash : { *(.hash) }
> + .gnu.hash : { *(.gnu.hash) }
> + .dynsym : { *(.dynsym) }
> + .dynstr : { *(.dynstr) }
> + .gnu.version : { *(.gnu.version) }
> + .gnu.version_d : { *(.gnu.version_d) }
> + .gnu.version_r : { *(.gnu.version_r) }
> + .rel.init : { *(.rel.init) }
> + .rela.init : { *(.rela.init) }
> + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
> + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
> + .rel.fini : { *(.rel.fini) }
> + .rela.fini : { *(.rela.fini) }
> + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
> + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
> + .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
> + .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
> + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
> + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
> + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
> + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
> + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
> + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
> + .rel.ctors : { *(.rel.ctors) }
> + .rela.ctors : { *(.rela.ctors) }
> + .rel.dtors : { *(.rel.dtors) }
> + .rela.dtors : { *(.rela.dtors) }
> + .rel.got : { *(.rel.got) }
> + .rela.got : { *(.rela.got) }
> + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
> + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
> + .rel.plt : { *(.rel.plt) }
> + .rela.plt : { *(.rela.plt) }
> + .init :
> + {
> + KEEP (*(.init))
> + } =0x07070707
> + .plt : { *(.plt) }
> + .text :
> + {
> + *(.text .stub .text.* .gnu.linkonce.t.*)
> + /* .gnu.warning sections are handled specially by elf32.em. */
> + *(.gnu.warning)
> + } =0x07070707
> + .fini :
> + {
> + KEEP (*(.fini))
> + } =0x07070707
> + PROVIDE (__etext = .);
> + PROVIDE (_etext = .);
> + PROVIDE (etext = .);
> + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
> + .rodata1 : { *(.rodata1) }
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
> + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
> + /* Adjust the address for the data segment. We want to adjust up to
> + the same address within the page on the next page up. */
> + . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
> + /* Exception handling */
> + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
> + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
> + /* Thread Local Storage sections */
> + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
> + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
> + .preinit_array :
> + {
> + PROVIDE_HIDDEN (__preinit_array_start = .);
> + KEEP (*(.preinit_array))
> + PROVIDE_HIDDEN (__preinit_array_end = .);
> + }
> + .init_array :
> + {
> + PROVIDE_HIDDEN (__init_array_start = .);
> + KEEP (*(SORT(.init_array.*)))
> + KEEP (*(.init_array))
> + PROVIDE_HIDDEN (__init_array_end = .);
> + }
> + .fini_array :
> + {
> + PROVIDE_HIDDEN (__fini_array_start = .);
> + KEEP (*(.fini_array))
> + KEEP (*(SORT(.fini_array.*)))
> + PROVIDE_HIDDEN (__fini_array_end = .);
> + }
> + .ctors :
> + {
> + /* gcc uses crtbegin.o to find the start of
> + the constructors, so we make sure it is
> + first. Because this is a wildcard, it
> + doesn't matter if the user does not
> + actually link against crtbegin.o; the
> + linker won't look for a file to match a
> + wildcard. The wildcard also means that it
> + doesn't matter which directory crtbegin.o
> + is in. */
> + KEEP (*crtbegin.o(.ctors))
> + KEEP (*crtbegin?.o(.ctors))
> + /* We don't want to include the .ctor section from
> + the crtend.o file until after the sorted ctors.
> + The .ctor section from the crtend file contains the
> + end of ctors marker and it must be last */
> + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
> + KEEP (*(SORT(.ctors.*)))
> + KEEP (*(.ctors))
> + }
> + .dtors :
> + {
> + KEEP (*crtbegin.o(.dtors))
> + KEEP (*crtbegin?.o(.dtors))
> + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
> + KEEP (*(SORT(.dtors.*)))
> + KEEP (*(.dtors))
> + }
> + .jcr : { KEEP (*(.jcr)) }
> + .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
> + .dynamic : { *(.dynamic) }
> + . = DATA_SEGMENT_RELRO_END (0, .);
> + .got : { *(.got.plt) *(.got) }
> + .data :
> + {
> + *(.data .data.* .gnu.linkonce.d.*)
> + SORT(CONSTRUCTORS)
> + }
> + .data1 : { *(.data1) }
> + _edata = .; PROVIDE (edata = .);
> + __bss_start = .;
> + .bss :
> + {
> + *(.dynbss)
> + *(.bss .bss.* .gnu.linkonce.b.*)
> + *(COMMON)
> + /* Align here to ensure that the .bss section occupies space up to
> + _end. Align after .bss to ensure correct alignment even if the
> + .bss section disappears because there are no input sections.
> + FIXME: Why do we need it? When there is no .bss section, we don't
> + pad the .data section. */
> + . = ALIGN(. != 0 ? 64 / 8 : 1);
> + }
> + . = ALIGN(64 / 8);
> + . = ALIGN(64 / 8);
> + _end = .; PROVIDE (end = .);
> + . = DATA_SEGMENT_END (.);
> + /* Stabs debugging sections. */
> + .stab 0 : { *(.stab) }
> + .stabstr 0 : { *(.stabstr) }
> + .stab.excl 0 : { *(.stab.excl) }
> + .stab.exclstr 0 : { *(.stab.exclstr) }
> + .stab.index 0 : { *(.stab.index) }
> + .stab.indexstr 0 : { *(.stab.indexstr) }
> + .comment 0 : { *(.comment) }
> + /* DWARF debug sections.
> + Symbols in the DWARF debugging sections are relative to the beginning
> + of the section so we begin them at 0. */
> + /* DWARF 1 */
> + .debug 0 : { *(.debug) }
> + .line 0 : { *(.line) }
> + /* GNU DWARF 1 extensions */
> + .debug_srcinfo 0 : { *(.debug_srcinfo) }
> + .debug_sfnames 0 : { *(.debug_sfnames) }
> + /* DWARF 1.1 and DWARF 2 */
> + .debug_aranges 0 : { *(.debug_aranges) }
> + .debug_pubnames 0 : { *(.debug_pubnames) }
> + /* DWARF 2 */
> + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
> + .debug_abbrev 0 : { *(.debug_abbrev) }
> + .debug_line 0 : { *(.debug_line) }
> + .debug_frame 0 : { *(.debug_frame) }
> + .debug_str 0 : { *(.debug_str) }
> + .debug_loc 0 : { *(.debug_loc) }
> + .debug_macinfo 0 : { *(.debug_macinfo) }
> + /* SGI/MIPS DWARF 2 extensions */
> + .debug_weaknames 0 : { *(.debug_weaknames) }
> + .debug_funcnames 0 : { *(.debug_funcnames) }
> + .debug_typenames 0 : { *(.debug_typenames) }
> + .debug_varnames 0 : { *(.debug_varnames) }
> + /* DWARF 3 */
> + .debug_pubtypes 0 : { *(.debug_pubtypes) }
> + .debug_ranges 0 : { *(.debug_ranges) }
> + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
> + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
> +}
Is this file really related with *guest* support?
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index c50beb7..83a44d8 100644
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -1,5 +1,5 @@
> #!/bin/sh
> -# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
> +# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel
>
> # load the binfmt_misc module
> if [ ! -d /proc/sys/fs/binfmt_misc ]; then
> @@ -63,4 +63,6 @@ fi
> if [ $cpu != "sh" ] ; then
> echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
> echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
> +if [ $cpu != "s390x" ] ; then
> + echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register
> fi
Except coding style and a few minor issues, it looks fine. That said I
don't know very well, and I would appreciate if someone with a good
knowledge of linux-user can review it. Riku maybe (CC:ed)?
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply
* [U-Boot] [PATCH] Fix the issue of _end symbol not being found while building
From: Sughosh Ganu @ 2011-04-10 20:16 UTC (permalink / raw)
To: u-boot
Fix the nand_spl build for the hawkboard
Signed-off-by: Sughosh Ganu <urwithsughosh@gmail.com>
---
nand_spl/board/davinci/da8xxevm/u-boot.lds | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/nand_spl/board/davinci/da8xxevm/u-boot.lds b/nand_spl/board/davinci/da8xxevm/u-boot.lds
index c86117b..638ffd9 100644
--- a/nand_spl/board/davinci/da8xxevm/u-boot.lds
+++ b/nand_spl/board/davinci/da8xxevm/u-boot.lds
@@ -68,6 +68,8 @@ SECTIONS
__got_end = .;
+ _end = .;
+
. = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) }
--
1.7.1
^ permalink raw reply related
* [PATCH 6/6] README.hardware: automate boot process for router station pro
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
In-Reply-To: <cover.1302466269.git.sgw@linux.intel.com>
From: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
README.hardware | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/README.hardware b/README.hardware
index 025c678..b2ce146 100644
--- a/README.hardware
+++ b/README.hardware
@@ -392,3 +392,25 @@ To boot the flashed kernel perform the following steps.
(-e means 'elf', -d 'decompress')
2) Execute the kernel using the exec command as above.
+
+--- Automating the boot process ---
+
+After writing the kernel to flash and testing the load and exec commands
+manually, you can automate the boot process with a boot script.
+
+1) RedBoot> fconfig
+ (Answer the questions not specified here as they pertain to your environment)
+2) Run script at boot: true
+ Boot script:
+ .. fis load -d -e kernel
+ .. exec
+ Enter script, terminate with empty line
+ >> fis load -d -e kernel
+ >> exec -c "console=ttyS0,115200 root=/dev/sda1 rw rootdelay=2 board=UBNT-RSPRO"
+ >>
+3) Answer the remaining questions and write the changes to flash:
+ Update RedBoot non-volatile configuration - continue (y/n)? y
+ ... Erase from 0xbfff0000-0xc0000000: .
+ ... Program from 0x87ff0000-0x88000000 at 0xbfff0000: .
+4) Power cycle the board.
+
--
1.7.1.1
^ permalink raw reply related
* [PATCH 4/6] clutter-1.6: fix SRC_URI[md5sum]
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
In-Reply-To: <cover.1302466269.git.sgw@linux.intel.com>
From: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/recipes-graphics/clutter/clutter-1.6_1.6.8.bb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/meta/recipes-graphics/clutter/clutter-1.6_1.6.8.bb b/meta/recipes-graphics/clutter/clutter-1.6_1.6.8.bb
index 7ead5f9..04935e3 100644
--- a/meta/recipes-graphics/clutter/clutter-1.6_1.6.8.bb
+++ b/meta/recipes-graphics/clutter/clutter-1.6_1.6.8.bb
@@ -21,5 +21,5 @@ do_configure_prepend () {
sed -i -e 's/^DOLT//' ${S}/configure.ac
}
-SRC_URI[md5sum] = "5a3c6d8414d4e286aba0a936f344c9b1""
+SRC_URI[md5sum] = "9eedac4216f709a9f144940d24bfbb3e"
SRC_URI[sha256sum] = "cc147b8e7e62ed4b9b8a83df3db9788cf37db0c83970ba876228433f32bda442"
--
1.7.1.1
^ permalink raw reply related
* [PATCH 3/6] eglibc-package.inc: Add eglibc-binaries, eglibc-localedatas, eglibc-gconvs and eglibc-charmps to variable PACKAGE
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
In-Reply-To: <cover.1302466269.git.sgw@linux.intel.com>
From: Xiaofeng Yan <xiaofeng.yan@windriver.com>
The purpose of adding the above variables it to make it easier to
install them into a lsb-image. By having 4 collections of packages
they will not fill the task-poky-lsb.bb file.
eglibc-binaries include packages "eglibc-binary-*"
eglibc-localedatas include packages "eglibc-localedata-*"
eglibc-gconvs include packages "eglibc-gconv-*"
eglibc-charmaps include packages "eglibc-charmap-*"
[sgw: edited summary and description]
Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/recipes-core/eglibc/eglibc-package.inc | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/meta/recipes-core/eglibc/eglibc-package.inc b/meta/recipes-core/eglibc/eglibc-package.inc
index 01275aa..fa6dc3c 100644
--- a/meta/recipes-core/eglibc/eglibc-package.inc
+++ b/meta/recipes-core/eglibc/eglibc-package.inc
@@ -44,6 +44,26 @@ PACKAGES_DYNAMIC = " \
eglibc-gconv-* eglibc-charmap-* eglibc-localedata-* eglibc-binary-localedata-* \
locale-base-*${PKGSUFFIX}"
+# Create a eglibc-binaries
+ALLOW_EMPTY_${PN}-binaries = "1"
+PACKAGES += "${PN}-binaries"
+RRECOMMENDS_${PN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-binary") != -1])}"
+
+# Create a eglibc-charmaps package
+ALLOW_EMPTY_${PN}-charmaps = "1"
+PACKAGES += "${PN}-charmaps"
+RRECOMMENDS_${PN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-charmap") != -1])}"
+
+# Create a eglibc-gconvs package
+ALLOW_EMPTY_${PN}-gconvs = "1"
+PACKAGES += "${PN}-gconvs"
+RRECOMMENDS_${PN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-gconv") != -1])}"
+
+# Create a eglibc-localedatas package
+ALLOW_EMPTY_${PN}-localedatas = "1"
+PACKAGES += "${PN}-localedatas"
+RRECOMMENDS_${PN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-localedata") != -1])}"
+
RPROVIDES_eglibc = "glibc"
RPROVIDES_eglibc-utils = "glibc-utils"
RPROVIDES_eglibc-pic = "glibc-pic"
--
1.7.1.1
^ permalink raw reply related
* [PATCH 5/6] qt4-x11-free: add virtual/libgl for opengl dependency
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
In-Reply-To: <cover.1302466269.git.sgw@linux.intel.com>
From: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/recipes-qt/qt4/qt4-x11-free.inc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-qt/qt4/qt4-x11-free.inc b/meta/recipes-qt/qt4/qt4-x11-free.inc
index 306adb9..ba08dc8 100644
--- a/meta/recipes-qt/qt4/qt4-x11-free.inc
+++ b/meta/recipes-qt/qt4/qt4-x11-free.inc
@@ -4,9 +4,9 @@ DESCRIPTION = "Qt is a versatile cross-platform application framework -- this is
HOMEPAGE = "http://qt.nokia.com"
SECTION = "x11/libs"
PRIORITY = "optional"
-DEPENDS += "virtual/libx11 fontconfig libxft libxext libxrender libxrandr libxcursor"
+DEPENDS += "virtual/libgl virtual/libx11 fontconfig libxft libxext libxrender libxrandr libxcursor"
-INC_PR = "r21"
+INC_PR = "r22"
QT_GLFLAGS ?= "-no-opengl"
QT_GLFLAGS_qemux86 = "-opengl"
--
1.7.1.1
^ permalink raw reply related
* [PATCH 2/6] Allow JFFS2 image options to be overridden
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
In-Reply-To: <cover.1302466269.git.sgw@linux.intel.com>
From: Gary Thomas <gary@mlbassoc.com>
Signed-off-by: Gary Thomas <gary@mlbassoc.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/classes/image_types.bbclass | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index f11a7ed..f23c1f5 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -63,7 +63,7 @@ IMAGE_CMD_ubi () {
IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}"
EXTRA_IMAGECMD = ""
-EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --eraseblock=0x40000"
+EXTRA_IMAGECMD_jffs2 ?= "--pad --little-endian --eraseblock=0x40000"
EXTRA_IMAGECMD_yaffs2 = "1"
# Change these if you want default genext2fs behavior (i.e. create minimal inode number)
EXTRA_IMAGECMD_ext2 ?= "-i 8192"
--
1.7.1.1
^ permalink raw reply related
* [PATCH 1/6] autotools: Pass --disable-silent-rules to configure
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
In-Reply-To: <cover.1302466269.git.sgw@linux.intel.com>
From: Colin Walters <walters@verbum.org>
Non-verbose logs are really annoying when trying to debug a build
failure. A lot of projects are copying in the flag to use
AM_SILENT_RULES which automake gained recently. We need to undo
this.
We'll get a warning from configure if it's not recognized, but that's
fine.
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/classes/autotools.bbclass | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index bc891f9..7ebf833 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -63,6 +63,7 @@ CONFIGUREOPTS = " --build=${BUILD_SYS} \
--oldincludedir=${oldincludedir} \
--infodir=${infodir} \
--mandir=${mandir} \
+ --disable-silent-rules \
${@append_libtool_sysroot(d)}"
oe_runconf () {
--
1.7.1.1
^ permalink raw reply related
* [PATCH 0/6] Cumulative patches from Mailing List
From: Saul Wold @ 2011-04-10 20:13 UTC (permalink / raw)
To: openembedded-core; +Cc: Darren Hart, Xiaofeng Yan
From: Saul Wold <sgw@linux.intel.com>
Richard,
Here is a set of patches from the Mailing list that I have pulled
together and tested, these address a varitey of issues along with
some autobuilder failure fixes
Sau!
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: distro/oe-core
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=distro/oe-core
Thanks,
Saul Wold <sgw@linux.intel.com>
---
Colin Walters (1):
autotools: Pass --disable-silent-rules to configure
Darren Hart (1):
README.hardware: automate boot process for router station pro
Gary Thomas (1):
Allow JFFS2 image options to be overridden
Saul Wold (2):
clutter-1.6: fix SRC_URI[md5sum]
qt4-x11-free: add virtual/libgl for opengl dependency
Xiaofeng Yan (1):
eglibc-package.inc: Add eglibc-binaries, eglibc-localedatas,
eglibc-gconvs and eglibc-charmps to variable PACKAGE
README.hardware | 22 ++++++++++++++++++++
meta/classes/autotools.bbclass | 1 +
meta/classes/image_types.bbclass | 2 +-
meta/recipes-core/eglibc/eglibc-package.inc | 20 ++++++++++++++++++
meta/recipes-graphics/clutter/clutter-1.6_1.6.8.bb | 2 +-
meta/recipes-qt/qt4/qt4-x11-free.inc | 4 +-
6 files changed, 47 insertions(+), 4 deletions(-)
^ permalink raw reply
* Re: kernel BUG at arch/x86/xen/mmu.c:1872
From: Teck Choon Giam @ 2011-04-10 20:14 UTC (permalink / raw)
To: MaoXiaoyun; +Cc: jeremy, xen devel, keir, ian.campbell, konrad.wilk, dave
In-Reply-To: <BLU157-w540B39FBA137B4D96278D2DAA90@phx.gbl>
[-- Attachment #1: Type: text/plain, Size: 4583 bytes --]
2011/4/10 MaoXiaoyun <tinnycloud@hotmail.com>:
> Hi Konrad & Jeremy:
>
> I think we finally located the missing patch for this commit.
> We test commit
> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=c97f681f138039425c87f35ea46a92385d81e70e
> which is works.
>
> We test commit
> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=221c64dbf860d37f841f40893bddf8d804aa55bd
> which server crashed.
>
> Later I found the comments for this commit:
>
> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=64141da587241301ce8638cc945f8b67853156ec
>
> So It looks like this fix is not applied on 2.6.32.36, Could you
> take a look at this?
>
> Many thanks.
>
> =====================================================
>>Hi Konrad & Jeremy:
>>
>> I'd like to open this BUG in a new thread, since the old thread is too
>> long for easy read.
>>
>> We recently want to upgrade our kernel to 2.6.32, but unfortunately,
>> we confront a kernel crash bug.
>>Our test case is simple, start 24 win2003 HVMS on our physical machine, and
>> each HVM reboot
>>every 15minutes. The kernel will crash in half an hour.(That is crash on VM
>> second starts).
>>
>>Our test go much further.
>>We test different kernel version.
>>2.6.32.10
>> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=d945b014ac5df9592c478bf9486d97e8914aab59
>>2.6.32.11
>> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=27f948a3bf365a5bc3d56119637a177d41147815
>>2.6.32.12
>> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=ba739f9abd3f659b907a824af1161926b420a2ce
>>2.6.32.13
>> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=f6fe6583b77a49b569eef1b66c3d761eec2e561b
>>2.6.32.15
>> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=27ed1b0e0dae5f1d5da5c76451bc84cb529128bd
>>2.6.32.21
>> http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=69e50db231723596ed8ef9275d0068d6697f466a
>>
>>There are basic three different result we met.
>>
>>i1) grant table issue
>>The host still function, but use xm dmesg, we have abnormal log.
>>please refer to the attched log of grant table
>>
>>i2) kernel crash on a different place.
>>Host die during the test, after reboot, we can see nothing abnormal in
>> /var/log/messages
>>
>>i3) kernel BUG at arch/x86/xen/mmu.c:1872;
>>Host die during the test, after reboot, we see the crash log in messages,
>> refer to the attached log of 2.6.32.36
>>Summary of the test result, can be classified in two:
>>
>>1) 2.6.32.10
>>30 machines involved the test, and three has issue (i1), and two has issue
>> (i2), *no* issue (i3)
>>Other machines run tests successfully till now, more than 8 hours
>>
>>2)2.6.32.11 or later version.
>>Each version containers 10 machine for tests, and all machine crashed in
>> less than half an hour.
>>
>>Conclusion:
>>1) grant table issue exists in all kernel version
>>2) kernerl crash at different place may exist in all kernel versions, but
>> not happen so frequently, 2 out of 30
>>3) We observe the major difference of issue i3), from the test, it looks
>> like it is introduced between the version
>>2.6.32.10 and 2.6.32.11.
>>
>>Hope this help to locate the bug.
>>Many thanks.
>>
>>
>
Hi,
Sorry, since this mmu related BUG has been troubled me for very
long... I really want to "kill" this BUG but my knowledge in kernel
hacking and/or xen is very limited.
While waiting for Jeremy or Konrad or others ...
Many thanks for spending time to track down this mmu related BUG. I
have backported the commit from
http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=64141da587241301ce8638cc945f8b67853156ec
to 2.6.32.36 PVOPS kernel and patch attached. I won't know whether
did I backport it correctly nor does it affects anything. I am
currently testing the 2.6.32.36 PVOPS kernel with this patch applied
and also unset CONFIG_DEBUG_PAGEALLOC. Currently running testcrash.sh
loop 1000 as I am unable to reproduce this mmu BUG 1872 in
testcrash.sh loop 100. Please note that when CONFIG_DEBUG_PAGEALLOC
is unset, I can reproduce this mmu BUG 1872 easily within <50
testcrash.sh loop cycle with PVOPS version 2.6.32.24 to 2.6.32.36
kernel. Now test with this backport patch to see whether I can
reproduce this mmu BUG... ...
Kindest regards,
Giam Teck Choon
[-- Attachment #2: vmalloc__eagerly_clear_ptes_on_vunmap.patch --]
[-- Type: text/x-patch, Size: 3393 bytes --]
Back port from commit http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commit;h=64141da587241301ce8638cc945f8b67853156ec
diff -urN a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
--- a/arch/x86/xen/mmu.c 2011-03-30 06:17:46.000000000 +0800
+++ b/arch/x86/xen/mmu.c 2011-04-11 02:17:54.000000000 +0800
@@ -2430,8 +2430,6 @@
x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start;
x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done;
pv_mmu_ops = xen_mmu_ops;
-
- vmap_lazy_unmap = false;
}
/* Protected by xen_reservation_lock. */
diff -urN a/include/linux/vmalloc.h b/include/linux/vmalloc.h
--- a/include/linux/vmalloc.h 2011-03-30 06:17:46.000000000 +0800
+++ b/include/linux/vmalloc.h 2011-04-11 02:18:43.000000000 +0800
@@ -7,8 +7,6 @@
struct vm_area_struct; /* vma defining user mapping in mm_types.h */
-extern bool vmap_lazy_unmap;
-
/* bits in flags of vmalloc's vm_struct below */
#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
#define VM_ALLOC 0x00000002 /* vmalloc() */
diff -urN a/mm/vmalloc.c b/mm/vmalloc.c
--- a/mm/vmalloc.c 2011-03-30 06:17:46.000000000 +0800
+++ b/mm/vmalloc.c 2011-04-11 02:25:38.000000000 +0800
@@ -31,8 +31,6 @@
#include <asm/tlbflush.h>
#include <asm/shmparam.h>
-bool vmap_lazy_unmap __read_mostly = true;
-
/*** Page table manipulation functions ***/
static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end)
@@ -503,9 +501,6 @@
{
unsigned int log;
- if (!vmap_lazy_unmap)
- return 0;
-
log = fls(num_online_cpus());
return log * (32UL * 1024 * 1024 / PAGE_SIZE);
@@ -566,7 +561,6 @@
if (va->va_end > *end)
*end = va->va_end;
nr += (va->va_end - va->va_start) >> PAGE_SHIFT;
- unmap_vmap_area(va);
list_add_tail(&va->purge_list, &valist);
va->flags |= VM_LAZY_FREEING;
va->flags &= ~VM_LAZY_FREE;
@@ -612,10 +606,11 @@
}
/*
- * Free and unmap a vmap area, caller ensuring flush_cache_vunmap had been
- * called for the correct range previously.
+ * Free a vmap area, caller ensuring that the area has been unmapped
+ * and flush_cache_vunmap had been called for the correct range
+ * previously.
*/
-static void free_unmap_vmap_area_noflush(struct vmap_area *va)
+static void free_vmap_area_noflush(struct vmap_area *va)
{
va->flags |= VM_LAZY_FREE;
atomic_add((va->va_end - va->va_start) >> PAGE_SHIFT, &vmap_lazy_nr);
@@ -624,6 +619,16 @@
}
/*
+ * Free and unmap a vmap area, caller ensuring flush_cache_vunmap had been
+ * called for the correct range previously.
+ */
+static void free_unmap_vmap_area_noflush(struct vmap_area *va)
+{
+ unmap_vmap_area(va);
+ free_vmap_area_noflush(va);
+}
+
+/*
* Free and unmap a vmap area
*/
static void free_unmap_vmap_area(struct vmap_area *va)
@@ -799,7 +804,7 @@
spin_unlock(&vmap_block_tree_lock);
BUG_ON(tmp != vb);
- free_unmap_vmap_area_noflush(vb->va);
+ free_vmap_area_noflush(vb->va);
call_rcu(&vb->rcu_head, rcu_free_vb);
}
@@ -936,6 +941,8 @@
rcu_read_unlock();
BUG_ON(!vb);
+ vunmap_page_range((unsigned long)addr, (unsigned long)addr + size);
+
spin_lock(&vb->lock);
BUG_ON(bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order));
@@ -988,7 +995,6 @@
s = vb->va->va_start + (i << PAGE_SHIFT);
e = vb->va->va_start + (j << PAGE_SHIFT);
- vunmap_page_range(s, e);
flush = 1;
if (s < start)
[-- Attachment #3: testcrash.sh --]
[-- Type: application/x-sh, Size: 5573 bytes --]
[-- Attachment #4: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply
* Re: [PATCH] RDMA/cxgb4: missing parentheses
From: Steve Wise @ 2011-04-10 20:12 UTC (permalink / raw)
To: roel; +Cc: Steve Wise, linux-rdma, Andrew Morton, LKML
In-Reply-To: <4DA20964.6050806@gmail.com>
Acked-by: Steve Wise <swise@opengridcomputing.com>
On 4/10/2011 2:47 PM, roel wrote:
> Parens are missing: '|' has a higher presedence than '?'.
>
> Signed-off-by: Roel Kluin<roel.kluin@gmail.com>
> ---
> drivers/infiniband/hw/cxgb4/qp.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
> index 70a5a3c..80cab20 100644
> --- a/drivers/infiniband/hw/cxgb4/qp.c
> +++ b/drivers/infiniband/hw/cxgb4/qp.c
> @@ -214,7 +214,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
> V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */
> V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */
> V_FW_RI_RES_WR_PCIECHN(0) | /* set by uP at ri_init time */
> - t4_sq_onchip(&wq->sq) ? F_FW_RI_RES_WR_ONCHIP : 0 |
> + (t4_sq_onchip(&wq->sq) ? F_FW_RI_RES_WR_ONCHIP : 0) |
> V_FW_RI_RES_WR_IQID(scq->cqid));
> res->u.sqrq.dcaen_to_eqsize = cpu_to_be32(
> V_FW_RI_RES_WR_DCAEN(0) |
^ permalink raw reply
* Out of memory problem with newer firmware
From: Rafał Miłecki @ 2011-04-10 20:12 UTC (permalink / raw)
To: b43-dev
Summary:
1) Chris has ASUS WL500pv2 with OpenWRT
2) This is router with Broadcom 5354 SoC and LP-PHY card
3) Firmware 410.2160 (broadcom-wl-4.150.10.5.tar.bz2) works OK
4) Firmware 478.104 (broadcom-wl-4.178.10.4.tar.bz2) causes OOM
Larry was testing his LP-PHY with kmemleak but didn't find anything.
Chris traced a lot of skbs being allocated before OOM (500+).
I suspect that with new firmware we provide slightly different RX
packets to mac80211 and there is sth wrong with mac80211 causing SKBs
not being freed. I don't have any other idea how changing firmware
could cause out of memory problems.
The alloc code is question is dma.c::~585
skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
I've written patch to dump data we provide mac80211. My hope is to
notice differences in that data between older vs. newer firmware.
Chris: could you try attached patch and provide dmesg from older and
newer firmware with this patch applied?
--
Rafa?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmit.rx_count2.patch
Type: application/octet-stream
Size: 1676 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20110410/d2f241a2/attachment.obj>
^ permalink raw reply
* Re: Confused over packfile and index design
From: Steven E. Harris @ 2011-04-10 20:10 UTC (permalink / raw)
To: git
In-Reply-To: <alpine.LFD.2.00.1104092147520.28032@xanadu.home>
Nicolas Pitre <nico@fluxnic.net> writes:
> So the idea is to do that once to construct the pack index and allow
> for random access once the index is available. Accessing a particular
> object without the pack index would be extremely costly otherwise,
> especially if it is towards the end of the pack.
Thanks for the explanation. It's clear now.
> The reason for storing only the expanded data size is to have the
> exact buffer size allocated for the inflated data. The zlib stream
> that follows is encoded to consume only the needed data to produce the
> inflated object. When the output buffer is all used, the zlib library
> should flag the end of the deflated stream. If not then there is an
> error in the pack data.
That provides some error checking, then, as we trust zlib to know when
it's had enough input, and we have to trust its assessment on how much
is enough, given the lack of delimiting or framing in the packfile
format.
By the way, I looked over the zlib manual¹, and I see that many of the
inflating/decompressing functions require the caller to specify the
number of input bytes available. There is inflateBack() that uses
callback functions to request more data upon underflow. The higher-level
inflate() function also looks like it can be called in a loop, refilling
the input buffer upon underflow. Is Git using one of these two functions
here?
[...]
> When in doubt, the code is always the ultimate source of information.
Yes, I need to learn my way around in there to find the call sites
relevant to this discussion.
Footnotes:
¹ http://www.zlib.net/manual.html
--
Steven E. Harris
^ permalink raw reply
* Re: [Qemu-devel] [PATCH 01/15] s390x: fix virtio feature bitmap
From: Alexander Graf @ 2011-04-10 20:11 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: peter.maydell, QEMU-devel Developers, Richard Henderson
In-Reply-To: <20110410200653.GE4551@volta.aurel32.net>
On 10.04.2011, at 22:06, Aurelien Jarno wrote:
> On Sun, Apr 10, 2011 at 09:26:26PM +0200, Alexander Graf wrote:
>>
>> On 10.04.2011, at 21:25, Aurelien Jarno wrote:
>>
>>> On Mon, Apr 04, 2011 at 04:32:10PM +0200, Alexander Graf wrote:
>>>> The feature bitmap in the s390 virtio machine is little endian. To
>>>> address for that, we need to bswap the values after reading them out.
>>>>
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>> ---
>>>> hw/s390-virtio-bus.c | 4 ++--
>>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
>>>> index 58af164..60e0135 100644
>>>> --- a/hw/s390-virtio-bus.c
>>>> +++ b/hw/s390-virtio-bus.c
>>>> @@ -223,7 +223,7 @@ void s390_virtio_device_sync(VirtIOS390Device *dev)
>>>> cur_offs += num_vq * VIRTIO_VQCONFIG_LEN;
>>>>
>>>> /* Sync feature bitmap */
>>>> - stl_phys(cur_offs, dev->host_features);
>>>> + stl_phys(cur_offs, bswap32(dev->host_features));
>>>
>>> Is bswap32 correct here for both big and little endian guests? I don't
>>> really understand the reason why a bswap is needed here, especially
>>> given that AFAIK this code was already used when using KVM.
>>
>> This is target specific code. The s390-virtio-bus is s390 specific. And yes, the code was also broken with KVM. That's how I first found it actually.
>>
>
> So in short, s390-virtio-bus is specific to big endian machines, but is
> using little endian? That looks a bit weired. I guess it's probably to
> late to change the specification anyway...
Yeah. In fact, it mixes big and little endian pieces. But it really is too late to change the (unwritten) spec, unfortunately.
Alex
^ permalink raw reply
* [Qemu-devel] Re: [PATCH] target-ppc: remove #ifdef FLOAT128
From: Peter Maydell @ 2011-04-10 20:08 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-devel, Aurelien Jarno
In-Reply-To: <E7FFE5CB-E8F0-489F-835F-3D8F9FF2F890@suse.de>
On 10 April 2011 20:23, Alexander Graf <agraf@suse.de> wrote:
> On 10.04.2011, at 21:12, Aurelien Jarno wrote:
>> Now that PPC defaults to softfloat which always provides float128
>> support, there is no need to keep two version of the code, depending if
>> float128 support is available or not. Suggested by Peter Maydell.
> Looks good to me, but I'd leave this to Peter's ack.
I think it's a sensible (and pretty straightforward) cleanup, yes.
[my bias towards emulation-accuracy means I don't really see
much place for softfloat-native in a tcg qemu target, so I have
no compunction about dropping support for it. :-)]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply
* Re: [Qemu-devel] [PATCH 15/15] tcg: use ext op for deposit
From: Aurelien Jarno @ 2011-04-10 20:08 UTC (permalink / raw)
To: Alexander Graf; +Cc: peter.maydell, QEMU-devel Developers, Richard Henderson
In-Reply-To: <986A40B3-391F-4B4F-B072-FE9F23B552BF@suse.de>
On Sun, Apr 10, 2011 at 09:25:33PM +0200, Alexander Graf wrote:
>
> On 10.04.2011, at 21:23, Aurelien Jarno wrote:
>
> > On Tue, Apr 05, 2011 at 09:55:09AM +0200, Alexander Graf wrote:
> >>
> >> On 05.04.2011, at 06:54, Aurelien Jarno wrote:
> >>
> >>> On Mon, Apr 04, 2011 at 04:32:24PM +0200, Alexander Graf wrote:
> >>>> With the s390x target we use the deposit instruction to store 32bit values
> >>>> into 64bit registers without clobbering the upper 32 bits.
> >>>>
> >>>> This specific operation can be optimized slightly by using the ext operation
> >>>> instead of an explicit and in the deposit instruction. This patch adds that
> >>>> special case to the generic deposit implementation.
> >>>>
> >>>> Signed-off-by: Alexander Graf <agraf@suse.de>
> >>>> ---
> >>>> tcg/tcg-op.h | 6 +++++-
> >>>> 1 files changed, 5 insertions(+), 1 deletions(-)
> >>>
> >>> Have you really measuring a difference here? This should already be
> >>> handled, at least on x86, by this code:
> >>>
> >>> if (TCG_TARGET_REG_BITS == 64) {
> >>> if (val == 0xffffffffu) {
> >>> tcg_out_ext32u(s, r0, r0);
> >>> return;
> >>> }
> >>> if (val == (uint32_t)val) {
> >>> /* AND with no high bits set can use a 32-bit operation. */
> >>> rexw = 0;
> >>> }
> >>> }
> >>
> >> I've certainly looked at the -d op logs and seen that instead of creating a const tcg variable plus an AND there was now an extu opcode issued, yes. No idea why the case up there didn't trigger.
> >>
> >
> > The question there is looking at -d out_asm. They should be the same at
> > the end as the code I pasted above is from tcg/i386/tcg-target.c.
>
> Yes. I was trying to optimize for maximum op length. TCG defines a maximum number of tcg ops to be issued by each target instruction. Since s390 is very CISCy, there are instructions that translate into lots of microops, but are still faster than a C call (register save/restore mostly).
>
> Without this patch, there are some places where we hit that number :).
Is it on 32-bit on or 64-bit? If we reach this number, it's probably
better to either implement this instruction with an helper, or maybe
increase the number of maximum ops. What is this instruction?
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply
* Re: [Qemu-devel] [PATCH 01/15] s390x: fix virtio feature bitmap
From: Aurelien Jarno @ 2011-04-10 20:06 UTC (permalink / raw)
To: Alexander Graf; +Cc: peter.maydell, QEMU-devel Developers, Richard Henderson
In-Reply-To: <2F05F566-871D-48B5-805A-B5FF48432193@suse.de>
On Sun, Apr 10, 2011 at 09:26:26PM +0200, Alexander Graf wrote:
>
> On 10.04.2011, at 21:25, Aurelien Jarno wrote:
>
> > On Mon, Apr 04, 2011 at 04:32:10PM +0200, Alexander Graf wrote:
> >> The feature bitmap in the s390 virtio machine is little endian. To
> >> address for that, we need to bswap the values after reading them out.
> >>
> >> Signed-off-by: Alexander Graf <agraf@suse.de>
> >> ---
> >> hw/s390-virtio-bus.c | 4 ++--
> >> 1 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
> >> index 58af164..60e0135 100644
> >> --- a/hw/s390-virtio-bus.c
> >> +++ b/hw/s390-virtio-bus.c
> >> @@ -223,7 +223,7 @@ void s390_virtio_device_sync(VirtIOS390Device *dev)
> >> cur_offs += num_vq * VIRTIO_VQCONFIG_LEN;
> >>
> >> /* Sync feature bitmap */
> >> - stl_phys(cur_offs, dev->host_features);
> >> + stl_phys(cur_offs, bswap32(dev->host_features));
> >
> > Is bswap32 correct here for both big and little endian guests? I don't
> > really understand the reason why a bswap is needed here, especially
> > given that AFAIK this code was already used when using KVM.
>
> This is target specific code. The s390-virtio-bus is s390 specific. And yes, the code was also broken with KVM. That's how I first found it actually.
>
So in short, s390-virtio-bus is specific to big endian machines, but is
using little endian? That looks a bit weired. I guess it's probably to
late to change the specification anyway...
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply
* [U-Boot] [PATCH] cfi_flash: reverse geometry for M29W800DT parts
From: Mike Frysinger @ 2011-04-10 20:06 UTC (permalink / raw)
To: u-boot
The M29W800DT parts also report their geometry with the sector layout
reversed. So add that ID to the flash_fixup_stm function.
Otherwise, we get:
bfin> flinfo
Bank # 1: CFI conformant FLASH (16 x 16) Size: 1 MB in 19 Sectors
AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x22D7
Erase timeout: 8192 ms, write timeout: 1 ms
Sector Start Addresses:
20000000 20004000 20006000 20008000 20010000
20020000 20030000 20040000 20050000 20060000
20070000 20080000 20090000 200A0000 200B0000
200C0000 200D0000 200E0000 200F0000
Reported-by: Jianxi Fu <fujianxi@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
drivers/mtd/cfi_flash.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 0909fe7..69f12d3 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1852,9 +1852,10 @@ static void flash_fixup_stm(flash_info_t *info, struct cfi_qry *qry)
if (qry->num_erase_regions > 1) {
/* reverse geometry if top boot part */
if (info->cfi_version < 0x3131) {
- /* CFI < 1.1, guess by device id (M29W320{DT,ET} only) */
- if (info->device_id == 0x22CA ||
- info->device_id == 0x2256) {
+ /* CFI < 1.1, guess by device id */
+ if (info->device_id == 0x22CA || /* M29W320DT */
+ info->device_id == 0x2256 || /* M29W320ET */
+ info->device_id == 0x22D7) { /* M29W800DT */
cfi_reverse_geometry(qry);
}
}
--
1.7.5.rc1
^ permalink raw reply related
* Re: btrfs does not work on usermode linux
From: Sergei Trofimovich @ 2011-04-10 20:06 UTC (permalink / raw)
To: Sergei Trofimovich, chris.mason; +Cc: linux-btrfs, cwillu
In-Reply-To: <20110410184249.483d8d67@sf>
[-- Attachment #1: Type: text/plain, Size: 3522 bytes --]
> > According to https://btrfs.wiki.kernel.org/index.php/Debugging_Btrfs_with_GDB
> > UML did work once.
> >
> > Now it corrupts data and triggers BUG_ON once you
> > start to use it. I tried both 2.6.38 and 2.6.39-rc2 (x86_64)
> > I need some help to track it down.
> >
> > doing 'touch `seq 1 11`; rm 11' kills the kernel:
>
> 2.6.36 works 2.6.37 doesn't. bsecting
Bisected down to:
commit 59daa706fbec745684702741b9f5373142dd9fdc (v2.6.36-rc2-2-g59daa70)
Author: Ma Ling <ling.ma@intel.com>
Date: Tue Jun 29 03:24:25 2010 +0800
x86, mem: Optimize memcpy by avoiding memory false dependece
Which means btrfs passes overlapping areas to memcpy. I've added some debug info
and found out rough place:
touching files 1 .. 11
#run> touch 1 2 3 4 5 6 7 8 9 10 11
[ 2.270000] memcpy overlap detected: memcpy(dst=0000000070654e8a, src=0000000070654ea9, size=171) [delta=31]
[ 2.270000] ------------[ cut here ]------------
[ 2.270000] WARNING: at /home/slyfox/linux-2.6/fs/btrfs/memcpy_debug.c:18 btrfs_memcpy+0x52/0x68()
[ 2.270000] Call Trace:
[ 2.270000] 7064b748: [<600eff46>] map_extent_buffer+0x62/0x9e
[ 2.270000] 7064b758: [<60029ad9>] warn_slowpath_common+0x59/0x70
[ 2.270000] 7064b798: [<60029b05>] warn_slowpath_null+0x15/0x17
[ 2.270000] 7064b7a8: [<6011129e>] btrfs_memcpy+0x52/0x68
[ 2.270000] 7064b7d8: [<600efa01>] memcpy_extent_buffer+0x18d/0x1da
[ 2.270000] 7064b858: [<600efae2>] memmove_extent_buffer+0x94/0x208
[ 2.270000] 7064b8d8: [<600bc4b0>] setup_items_for_insert+0x2b8/0x426
[ 2.270000] 7064b8e8: [<600bb25a>] btrfs_leaf_free_space+0x62/0xa6
[ 2.270000] 7064b9c8: [<600c13f3>] btrfs_insert_empty_items+0xa3/0xb5
[ 2.270000] 7064ba38: [<600ce690>] insert_with_overflow+0x33/0xf1
[ 2.270000] 7064ba88: [<600ce7d4>] btrfs_insert_dir_item+0x86/0x268
[ 2.270000] 7064bae8: [<601b498b>] _raw_spin_unlock+0x9/0xb
[ 2.270000] 7064bb48: [<600ddef1>] btrfs_add_link+0x10d/0x170
[ 2.270000] 7064bbc8: [<600ddf7a>] btrfs_add_nondir+0x26/0x52
[ 2.270000] 7064bc08: [<600de73f>] btrfs_create+0xf2/0x1c0
[ 2.270000] 7064bc18: [<6007ccff>] generic_permission+0x57/0x9d
[ 2.270000] 7064bc68: [<6007cf60>] vfs_create+0x6a/0x75
which is in extent_io:copy_pages. I haven't dig further only made sure the following
patch below (practically converts copy_pages to move_pages). It certainly does not
look the right thing, but I don't understand extent_io contents yet to understand what
actually happened.
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 20ddb28..4cab7db 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3893,14 +3893,17 @@ static void copy_pages(struct page *dst_page, struct page *src_page,
char *src_kaddr;
if (dst_page != src_page)
+ {
src_kaddr = kmap_atomic(src_page, KM_USER1);
+ memcpy(dst_kaddr + dst_off, src_kaddr + src_off, len);
+ kunmap_atomic(src_kaddr, KM_USER1);
+ }
else
+ {
src_kaddr = dst_kaddr;
-
- memcpy(dst_kaddr + dst_off, src_kaddr + src_off, len);
+ memmove(dst_kaddr + dst_off, src_kaddr + src_off, len);
+ }
kunmap_atomic(dst_kaddr, KM_USER0);
- if (dst_page != src_page)
- kunmap_atomic(src_kaddr, KM_USER1);
}
void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
--
Sergei
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related
* [PATCH 3/3] USB: ohci: add bus glue for the Atheros AR71XX/AR7240 SoCs
From: Gabor Juhos @ 2011-04-10 20:05 UTC (permalink / raw)
To: Ralf Baechle
Cc: linux-mips, Gabor Juhos, Imre Kaloz, Greg Kroah-Hartman,
Alan Stern, linux-usb
In-Reply-To: <1302465900-16814-1-git-send-email-juhosg@openwrt.org>
The Atheros AR71XX/AR7240 SoCs have a built-in OHCI controller.
This patch adds the necessary glue code to make the generic OHCI
driver usable for them.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
---
arch/mips/ath79/Kconfig | 2 +
drivers/usb/host/Kconfig | 8 ++
drivers/usb/host/ohci-ath79.c | 151 +++++++++++++++++++++++++++++++++++++++++
drivers/usb/host/ohci-hcd.c | 5 ++
4 files changed, 166 insertions(+), 0 deletions(-)
create mode 100644 drivers/usb/host/ohci-ath79.c
diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
index 649a2a3..4770741 100644
--- a/arch/mips/ath79/Kconfig
+++ b/arch/mips/ath79/Kconfig
@@ -27,10 +27,12 @@ endmenu
config SOC_AR71XX
select USB_ARCH_HAS_EHCI
+ select USB_ARCH_HAS_OHCI
def_bool n
config SOC_AR724X
select USB_ARCH_HAS_EHCI
+ select USB_ARCH_HAS_OHCI
def_bool n
config SOC_AR913X
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 9970c86..9a6751e 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -295,6 +295,14 @@ config USB_OHCI_HCD_OMAP3
Enables support for the on-chip OHCI controller on
OMAP3 and later chips.
+config USB_OHCI_ATH79
+ bool "USB OHCI support for the Atheros AR71XX/AR7240 SoCs"
+ depends on USB_OHCI_HCD && (SOC_AR71XX || SOC_AR724X)
+ default y
+ help
+ Enables support for the built-in OHCI controller present on the
+ Atheros AR71XX/AR7240 SoCs.
+
config USB_OHCI_HCD_PPC_SOC
bool "OHCI support for on-chip PPC USB controller"
depends on USB_OHCI_HCD && (STB03xxx || PPC_MPC52xx)
diff --git a/drivers/usb/host/ohci-ath79.c b/drivers/usb/host/ohci-ath79.c
new file mode 100644
index 0000000..ffea3e7
--- /dev/null
+++ b/drivers/usb/host/ohci-ath79.c
@@ -0,0 +1,151 @@
+/*
+ * OHCI HCD (Host Controller Driver) for USB.
+ *
+ * Bus Glue for Atheros AR71XX/AR724X built-in OHCI controller.
+ *
+ * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * Parts of this file are based on Atheros' 2.6.15 BSP
+ * Copyright (C) 2007 Atheros Communications, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+
+static int __devinit ohci_ath79_start(struct usb_hcd *hcd)
+{
+ struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+ int ret;
+
+ ret = ohci_init(ohci);
+ if (ret < 0)
+ return ret;
+
+ ret = ohci_run(ohci);
+ if (ret < 0)
+ goto err;
+
+ return 0;
+
+err:
+ ohci_stop(hcd);
+ return ret;
+}
+
+static const struct hc_driver ohci_ath79_hc_driver = {
+ .description = hcd_name,
+ .product_desc = "Atheros built-in OHCI controller",
+ .hcd_priv_size = sizeof(struct ohci_hcd),
+
+ .irq = ohci_irq,
+ .flags = HCD_USB11 | HCD_MEMORY,
+
+ .start = ohci_ath79_start,
+ .stop = ohci_stop,
+ .shutdown = ohci_shutdown,
+
+ .urb_enqueue = ohci_urb_enqueue,
+ .urb_dequeue = ohci_urb_dequeue,
+ .endpoint_disable = ohci_endpoint_disable,
+
+ /*
+ * scheduling support
+ */
+ .get_frame_number = ohci_get_frame,
+
+ /*
+ * root hub support
+ */
+ .hub_status_data = ohci_hub_status_data,
+ .hub_control = ohci_hub_control,
+ .start_port_reset = ohci_start_port_reset,
+};
+
+static int ohci_ath79_probe(struct platform_device *pdev)
+{
+ struct usb_hcd *hcd;
+ struct resource *res;
+ int irq;
+ int ret;
+
+ if (usb_disabled())
+ return -ENODEV;
+
+ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!res) {
+ dev_dbg(&pdev->dev, "no IRQ specified\n");
+ return -ENODEV;
+ }
+ irq = res->start;
+
+ hcd = usb_create_hcd(&ohci_ath79_hc_driver, &pdev->dev,
+ dev_name(&pdev->dev));
+ if (!hcd)
+ return -ENOMEM;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_dbg(&pdev->dev, "no base address specified\n");
+ ret = -ENODEV;
+ goto err_put_hcd;
+ }
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = res->end - res->start + 1;
+
+ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
+ dev_dbg(&pdev->dev, "controller already in use\n");
+ ret = -EBUSY;
+ goto err_put_hcd;
+ }
+
+ hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+ if (!hcd->regs) {
+ dev_dbg(&pdev->dev, "error mapping memory\n");
+ ret = -EFAULT;
+ goto err_release_region;
+ }
+
+ ohci_hcd_init(hcd_to_ohci(hcd));
+
+ ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
+ if (ret)
+ goto err_stop_hcd;
+
+ return 0;
+
+err_stop_hcd:
+ iounmap(hcd->regs);
+err_release_region:
+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+err_put_hcd:
+ usb_put_hcd(hcd);
+ return ret;
+}
+
+static int ohci_ath79_remove(struct platform_device *pdev)
+{
+ struct usb_hcd *hcd = platform_get_drvdata(pdev);
+
+ usb_remove_hcd(hcd);
+ iounmap(hcd->regs);
+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+ usb_put_hcd(hcd);
+
+ return 0;
+}
+
+static struct platform_driver ohci_hcd_ath79_driver = {
+ .probe = ohci_ath79_probe,
+ .remove = ohci_ath79_remove,
+ .shutdown = usb_hcd_platform_shutdown,
+ .driver = {
+ .name = "ath79-ohci",
+ .owner = THIS_MODULE,
+ },
+};
+
+MODULE_ALIAS(PLATFORM_MODULE_PREFIX "ath79-ohci");
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index e728863..8aec65f 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1105,6 +1105,11 @@ MODULE_LICENSE ("GPL");
#define PLATFORM_DRIVER ohci_hcd_cns3xxx_driver
#endif
+#ifdef CONFIG_USB_OHCI_ATH79
+#include "ohci-ath79.c"
+#define PLATFORM_DRIVER ohci_hcd_ath79_driver
+#endif
+
#if !defined(PCI_DRIVER) && \
!defined(PLATFORM_DRIVER) && \
!defined(OMAP1_PLATFORM_DRIVER) && \
--
1.7.2.1
^ permalink raw reply related
* [PATCH 2/3] USB: ehci: add workaround for Synopsys HC bug
From: Gabor Juhos @ 2011-04-10 20:04 UTC (permalink / raw)
To: Ralf Baechle
Cc: linux-mips, Gabor Juhos, Greg Kroah-Hartman, Alan Stern,
linux-usb
In-Reply-To: <1302465900-16814-1-git-send-email-juhosg@openwrt.org>
A Synopsys USB core used in various SoCs has a bug which might cause
that the host controller not issuing ping.
When software uses the Doorbell mechanism to remove queue heads, the
host controller still has references to the removed queue head even
after indicating an Interrupt on Async Advance. This happens if the last
executed queue head's Next Link queue head is removed.
Consequences of the defect:
The Host controller fetches the removed queue head, using memory that
would otherwise be deallocated.This results in incorrect transactions on
both the USB and system memory. This may result in undefined behavior.
Workarounds:
1) If no queue head is active (no Status field's Active bit is set)
after removing the queue heads, the software can write one of the valid
queue head addresses to the ASYNCLISTADDR register and deallocate the
removed queue head's memory after 2 microframes.
If one or more of the queue heads is active (the Active bit is set in
the Status field) after removing the queue heads, the software can delay
memory deallocation after time X, where X is the time required for the
Host Controller to go through all the queue heads once. X varies with
the number of queue heads and the time required to process periodic
transactions: if more periodic transactions must be performed, the Host
Controller has less time to process asynchronous transaction processing.
2) Do not use the Doorbell mechanism to remove the queue heads. Disable
the Asynchronous Schedule Enable bit instead.
The bug has been discussed on the linux-usb-devel mailing-list
four years ago, the original thread can be found here:
http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg45345.html
This patch implements the first workaround as suggested by David Brownell.
The built-in USB host controller of the Atheros AR7130/AR7141/AR7161 SoCs
requires this to work properly.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
---
drivers/usb/host/ehci-ath79.c | 2 ++
drivers/usb/host/ehci-q.c | 3 +++
drivers/usb/host/ehci.h | 1 +
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/host/ehci-ath79.c b/drivers/usb/host/ehci-ath79.c
index 74325b8..7ea23b5 100644
--- a/drivers/usb/host/ehci-ath79.c
+++ b/drivers/usb/host/ehci-ath79.c
@@ -54,6 +54,8 @@ static int ehci_ath79_init(struct usb_hcd *hcd)
switch (id->driver_data) {
case EHCI_ATH79_IP_V1:
+ ehci->has_synopsys_hc_bug = 1;
+
ehci->caps = hcd->regs;
ehci->regs = hcd->regs +
HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 98ded66..38c1206 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1183,6 +1183,9 @@ static void end_unlink_async (struct ehci_hcd *ehci)
ehci->reclaim = NULL;
start_unlink_async (ehci, next);
}
+
+ if (ehci->has_synopsys_hc_bug)
+ writel((u32)ehci->async->qh_dma, &ehci->regs->async_next);
}
/* makes sure the async qh will become idle */
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index f86d3fa..28ef8ca 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -134,6 +134,7 @@ struct ehci_hcd { /* one per controller */
unsigned amd_pll_fix:1;
unsigned fs_i_thresh:1; /* Intel iso scheduling */
unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/
+ unsigned has_synopsys_hc_bug:1; /* Synopsys HC */
/* required for usb32 quirk */
#define OHCI_CTRL_HCFS (3 << 6)
--
1.7.2.1
^ permalink raw reply related
* [PATCH 1/3] USB: ehci: add bus glue for the Atheros AR7XXX/AR9XXX SoCs
From: Gabor Juhos @ 2011-04-10 20:04 UTC (permalink / raw)
To: Ralf Baechle
Cc: linux-mips, Gabor Juhos, Imre Kaloz, Greg Kroah-Hartman,
Alan Stern, linux-usb
The Atheros AR71XX/AR9XXX SoCs have a built-in EHCI controller.
This patch adds the necessary glue code to make the generic EHCI
driver usable for them.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
---
arch/mips/ath79/Kconfig | 3 +
drivers/usb/host/Kconfig | 8 ++
drivers/usb/host/ehci-ath79.c | 200 +++++++++++++++++++++++++++++++++++++++++
drivers/usb/host/ehci-hcd.c | 5 +
4 files changed, 216 insertions(+), 0 deletions(-)
create mode 100644 drivers/usb/host/ehci-ath79.c
diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
index b058282..649a2a3 100644
--- a/arch/mips/ath79/Kconfig
+++ b/arch/mips/ath79/Kconfig
@@ -26,12 +26,15 @@ config ATH79_MACH_PB44
endmenu
config SOC_AR71XX
+ select USB_ARCH_HAS_EHCI
def_bool n
config SOC_AR724X
+ select USB_ARCH_HAS_EHCI
def_bool n
config SOC_AR913X
+ select USB_ARCH_HAS_EHCI
def_bool n
config ATH79_DEV_AR913X_WMAC
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 9483acd..9970c86 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -202,6 +202,14 @@ config USB_CNS3XXX_EHCI
It is needed for high-speed (480Mbit/sec) USB 2.0 device
support.
+config USB_EHCI_ATH79
+ bool "EHCI support for AR7XX/AR9XXX SoCs"
+ depends on USB_EHCI_HCD && ATH79
+ select USB_EHCI_ROOT_HUB_TT
+ ---help---
+ Enables support for the built-in EHCI controller present
+ on the Atheros AR7XXX/AR9XXX SoCs.
+
config USB_OXU210HP_HCD
tristate "OXU210HP HCD support"
depends on USB
diff --git a/drivers/usb/host/ehci-ath79.c b/drivers/usb/host/ehci-ath79.c
new file mode 100644
index 0000000..74325b8
--- /dev/null
+++ b/drivers/usb/host/ehci-ath79.c
@@ -0,0 +1,200 @@
+/*
+ * Bus Glue for Atheros AR7XXX/AR9XXX built-in EHCI controller.
+ *
+ * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * Parts of this file are based on Atheros' 2.6.15 BSP
+ * Copyright (C) 2007 Atheros Communications, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+
+enum {
+ EHCI_ATH79_IP_V1 = 0,
+ EHCI_ATH79_IP_V2,
+};
+
+static const struct platform_device_id ehci_ath79_id_table[] = {
+ {
+ .name = "ar71xx-ehci",
+ .driver_data = EHCI_ATH79_IP_V1,
+ },
+ {
+ .name = "ar724x-ehci",
+ .driver_data = EHCI_ATH79_IP_V2,
+ },
+ {
+ .name = "ar913x-ehci",
+ .driver_data = EHCI_ATH79_IP_V2,
+ },
+ {
+ /* terminating entry */
+ },
+};
+
+MODULE_DEVICE_TABLE(platform, ehci_ath79_id_table);
+
+static int ehci_ath79_init(struct usb_hcd *hcd)
+{
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+ struct platform_device *pdev = to_platform_device(hcd->self.controller);
+ const struct platform_device_id *id;
+ int ret;
+
+ id = platform_get_device_id(pdev);
+ if (!id) {
+ dev_err(hcd->self.controller, "missing device id\n");
+ return -EINVAL;
+ }
+
+ switch (id->driver_data) {
+ case EHCI_ATH79_IP_V1:
+ ehci->caps = hcd->regs;
+ ehci->regs = hcd->regs +
+ HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
+ break;
+
+ case EHCI_ATH79_IP_V2:
+ hcd->has_tt = 1;
+
+ ehci->caps = hcd->regs + 0x100;
+ ehci->regs = hcd->regs + 0x100 +
+ HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
+ break;
+
+ default:
+ BUG();
+ }
+
+ dbg_hcs_params(ehci, "reset");
+ dbg_hcc_params(ehci, "reset");
+ ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
+ ehci->sbrn = 0x20;
+
+ ehci_reset(ehci);
+
+ ret = ehci_init(hcd);
+ if (ret)
+ return ret;
+
+ ehci_port_power(ehci, 0);
+
+ return 0;
+}
+
+static const struct hc_driver ehci_ath79_hc_driver = {
+ .description = hcd_name,
+ .product_desc = "Atheros built-in EHCI controller",
+ .hcd_priv_size = sizeof(struct ehci_hcd),
+ .irq = ehci_irq,
+ .flags = HCD_MEMORY | HCD_USB2,
+
+ .reset = ehci_ath79_init,
+ .start = ehci_run,
+ .stop = ehci_stop,
+ .shutdown = ehci_shutdown,
+
+ .urb_enqueue = ehci_urb_enqueue,
+ .urb_dequeue = ehci_urb_dequeue,
+ .endpoint_disable = ehci_endpoint_disable,
+ .endpoint_reset = ehci_endpoint_reset,
+
+ .get_frame_number = ehci_get_frame,
+
+ .hub_status_data = ehci_hub_status_data,
+ .hub_control = ehci_hub_control,
+
+ .relinquish_port = ehci_relinquish_port,
+ .port_handed_over = ehci_port_handed_over,
+
+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
+};
+
+static int ehci_ath79_probe(struct platform_device *pdev)
+{
+ struct usb_hcd *hcd;
+ struct resource *res;
+ int irq;
+ int ret;
+
+ if (usb_disabled())
+ return -ENODEV;
+
+ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!res) {
+ dev_dbg(&pdev->dev, "no IRQ specified\n");
+ return -ENODEV;
+ }
+ irq = res->start;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_dbg(&pdev->dev, "no base address specified\n");
+ return -ENODEV;
+ }
+
+ hcd = usb_create_hcd(&ehci_ath79_hc_driver, &pdev->dev,
+ dev_name(&pdev->dev));
+ if (!hcd)
+ return -ENOMEM;
+
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = res->end - res->start + 1;
+
+ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
+ dev_dbg(&pdev->dev, "controller already in use\n");
+ ret = -EBUSY;
+ goto err_put_hcd;
+ }
+
+ hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+ if (!hcd->regs) {
+ dev_dbg(&pdev->dev, "error mapping memory\n");
+ ret = -EFAULT;
+ goto err_release_region;
+ }
+
+ ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
+ if (ret)
+ goto err_iounmap;
+
+ return 0;
+
+err_iounmap:
+ iounmap(hcd->regs);
+
+err_release_region:
+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+err_put_hcd:
+ usb_put_hcd(hcd);
+ return ret;
+}
+
+static int ehci_ath79_remove(struct platform_device *pdev)
+{
+ struct usb_hcd *hcd = platform_get_drvdata(pdev);
+
+ usb_remove_hcd(hcd);
+ iounmap(hcd->regs);
+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+ usb_put_hcd(hcd);
+
+ return 0;
+}
+
+static struct platform_driver ehci_ath79_driver = {
+ .probe = ehci_ath79_probe,
+ .remove = ehci_ath79_remove,
+ .id_table = ehci_ath79_id_table,
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "ath79-ehci",
+ }
+};
+
+MODULE_ALIAS(PLATFORM_MODULE_PREFIX "ath79-ehci");
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 78561d1..a29527d 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1265,6 +1265,11 @@ MODULE_LICENSE ("GPL");
#define PLATFORM_DRIVER tegra_ehci_driver
#endif
+#ifdef CONFIG_USB_EHCI_ATH79
+#include "ehci-ath79.c"
+#define PLATFORM_DRIVER ehci_ath79_driver
+#endif
+
#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
!defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
!defined(XILINX_OF_PLATFORM_DRIVER)
--
1.7.2.1
^ permalink raw reply related
* Re: [Qemu-devel] tcg/tcg.c:1892: tcg fatal error
From: Artyom Tarasenko @ 2011-04-10 20:00 UTC (permalink / raw)
To: Igor Kovalenko; +Cc: Blue Swirl, peter.maydell, qemu-devel, Aurelien Jarno
In-Reply-To: <BANLkTik2NChYi8hADjCSbjdZeyP_oo8_Qg@mail.gmail.com>
On Sun, Apr 10, 2011 at 9:41 PM, Igor Kovalenko
<igor.v.kovalenko@gmail.com> wrote:
> On Sun, Apr 10, 2011 at 11:37 PM, Artyom Tarasenko <atar4qemu@gmail.com> wrote:
>> On Sun, Apr 10, 2011 at 8:52 PM, Igor Kovalenko
>> <igor.v.kovalenko@gmail.com> wrote:
>>> On Sun, Apr 10, 2011 at 10:35 PM, Artyom Tarasenko <atar4qemu@gmail.com> wrote:
>>>> On Sun, Apr 10, 2011 at 7:57 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>>>> On Sun, Apr 10, 2011 at 8:48 PM, Artyom Tarasenko <atar4qemu@gmail.com> wrote:
>>>>>> On Sun, Apr 10, 2011 at 4:44 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>>>>>> On Sun, Apr 10, 2011 at 5:09 PM, Artyom Tarasenko <atar4qemu@gmail.com> wrote:
>>>>>>>> On Sun, Apr 10, 2011 at 3:24 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
>>>>>>>>> On Sun, Apr 10, 2011 at 02:29:59PM +0200, Artyom Tarasenko wrote:
>>>>>>>>>> Trying to boot some proprietary OS I get qemu-system-sparc64 crash with a
>>>>>>>>>>
>>>>>>>>>> tcg/tcg.c:1892: tcg fatal error
>>>>>>>>>>
>>>>>>>>>> error message.
>>>>>>>>>>
>>>>>>>>>> It looks like it can be a platform independent bug though, because
>>>>>>>>>> when a '-singlestep' option IS present, qemu doesn't crash and seems
>>>>>>>>>> to translate the code properly.
>>>>>>>>>>
>>>>>>>>>> (gdb) bt
>>>>>>>>>> #0 0x00000032c2e327f5 in raise () from /lib64/libc.so.6
>>>>>>>>>> #1 0x00000032c2e33fd5 in abort () from /lib64/libc.so.6
>>>>>>>>>> #2 0x000000000051933d in tcg_reg_alloc_call (s=<value optimized out>,
>>>>>>>>>> def=0x89d340, opc=INDEX_op_call, args=0x10acc98, dead_iargs=3) at
>>>>>>>>>> qemu/tcg/tcg.c:1892
>>>>>>>>>> #3 0x000000000051a557 in tcg_gen_code_common (s=0x10b8940,
>>>>>>>>>> gen_code_buf=0x40338b60 "I\213n@H\213] 3\355I\211\256\220") at
>>>>>>>>>> qemu/tcg/tcg.c:2099
>>>>>>>>>> #4 tcg_gen_code (s=0x10b8940, gen_code_buf=0x40338b60 "I\213n@H\213]
>>>>>>>>>> 3\355I\211\256\220") at qemu/tcg/tcg.c:2142
>>>>>>>>>> #5 0x00000000004d38f1 in cpu_sparc_gen_code (env=0x10cce10,
>>>>>>>>>> tb=0x7fffe91bc218, gen_code_size_ptr=0x7fffffffd9b4) at
>>>>>>>>>> qemu/translate-all.c:93
>>>>>>>>>> #6 0x00000000004d1fd7 in tb_gen_code (env=0x10cce10, pc=18868776,
>>>>>>>>>> cs_base=18868780, flags=15, cflags=0) at qemu/exec.c:989
>>>>>>>>>> #7 0x00000000004d4029 in tb_find_slow (env1=<value optimized out>) at
>>>>>>>>>> qemu/cpu-exec.c:167
>>>>>>>>>> #8 tb_find_fast (env1=<value optimized out>) at cpu-exec.c:194
>>>>>>>>>> #9 cpu_sparc_exec (env1=<value optimized out>) at qemu/cpu-exec.c:556
>>>>>>>>>> #10 0x0000000000408868 in tcg_cpu_exec () at qemu/cpus.c:1066
>>>>>>>>>> #11 cpu_exec_all () at qemu/cpus.c:1102
>>>>>>>>>> #12 0x000000000053c756 in main_loop (argc=<value optimized out>,
>>>>>>>>>> argv=<value optimized out>, envp=<value optimized out>) at
>>>>>>>>>> qemu/vl.c:1430
>>>>>>>>>>
>>>>>>>>>> I inspected ts->val_type causing the abort() case and it turned out to be 0.
>>>>>>>>>>
>>>>>>>>>> The last lines of qemu.log (without -singlestep)
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fe9f0: rdpr %pstate, %g1
>>>>>>>>>> 0x00000000011fe9f4: wrpr %g1, 2, %pstate
>>>>>>>>>> --------------
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fe9f8: ldub [ %o0 ], %o1
>>>>>>>>>> 0x00000000011fe9fc: mov %o1, %o2
>>>>>>>>>> 0x00000000011fea00: rdpr %tick, %o3
>>>>>>>>>> 0x00000000011fea04: cmp %o1, %o2
>>>>>>>>>> 0x00000000011fea08: be %icc, 0x11fea00
>>>>>>>>>> 0x00000000011fea0c: ldub [ %o0 ], %o2
>>>>>>>>>>
>>>>>>>>>> Search PC...
>>>>>>>>>> Search PC...
>>>>>>>>>> Search PC...
>>>>>>>>>> Search PC...
>>>>>>>>>> Search PC...
>>>>>>>>>> Search PC...
>>>>>>>>>> --------------
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fe9f8: ldub [ %o0 ], %o1
>>>>>>>>>> 0x00000000011fe9fc: mov %o1, %o2
>>>>>>>>>> 0x00000000011fea00: rdpr %tick, %o3
>>>>>>>>>> 0x00000000011fea04: cmp %o1, %o2
>>>>>>>>>> 0x00000000011fea08: be %icc, 0x11fea00
>>>>>>>>>> 0x00000000011fea0c: ldub [ %o0 ], %o2
>>>>>>>>>>
>>>>>>>>>> 110521: Data Access MMU Miss (v=0068) pc=00000000011fe9f8
>>>>>>>>>> npc=00000000011fe9fc SP=000000000180ae41
>>>>>>>>>> pc: 00000000011fe9f8 npc: 00000000011fe9fc
>>>>>>>>>>
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fea00: rdpr %tick, %o3
>>>>>>>>>> 0x00000000011fea04: cmp %o1, %o2
>>>>>>>>>> 0x00000000011fea08: be %icc, 0x11fea00
>>>>>>>>>> 0x00000000011fea0c: ldub [ %o0 ], %o2
>>>>>>>>>> --------------
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fea10: brz,pn %o2, 0x11fe9f8
>>>>>>>>>> 0x00000000011fea14: mov %o2, %o4
>>>>>>>>>> --------------
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fea18: rdpr %tick, %o5
>>>>>>>>>> 0x00000000011fea1c: cmp %o2, %o4
>>>>>>>>>> 0x00000000011fea20: be %icc, 0x11fea18
>>>>>>>>>> 0x00000000011fea24: ldub [ %o0 ], %o4
>>>>>>>>>> --------------
>>>>>>>>>> IN:
>>>>>>>>>> 0x00000000011fea28: brz,pn %o4, 0x11fe9f4
>>>>>>>>>> 0x00000000011fea2c: wrpr %g0, %g1, %pstate
>>>>>>>>>> <EOF>
>>>>>>>>>>
>>>>>>>>>> The crash is 100% reproducible and happens always on the same place,
>>>>>>>>>> so it's probably a pure TCG issue, not related on getting the
>>>>>>>>>> external/timer interrupts.
>>>>>>>>>>
>>>>>>>>>> Do you need any additional info?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> What would be interesting would be to get the corresponding TCG code
>>>>>>>>> from qemu.log (-d op,op_opt).
>>>>>>>>
>>>>>>>>
>>>>>>>> OP:
>>>>>>>> ---- 0x11fea28
>>>>>>>> ld_i64 tmp6,regwptr,$0x20
>>>>>>>> movi_i64 cond,$0x0
>>>>>>>> movi_i64 tmp8,$0x0
>>>>>>>> brcond_i64 tmp6,tmp8,ne,$0x0
>>>>>>>> movi_i64 cond,$0x1
>>>>>>>> set_label $0x0
>>>>>>>>
>>>>>>>> ---- 0x11fea2c
>>>>>>>> movi_i64 tmp7,$0x0
>>>>>>>> xor_i64 tmp0,tmp7,g1
>>>>>>>> movi_i64 pc,$0x11fea2c
>>>>>>>> movi_i64 tmp8,$compute_psr
>>>>>>>> call tmp8,$0x0,$0
>>>>>>>> movi_i64 tmp8,$0x0
>>>>>>>> brcond_i64 cond,tmp8,eq,$0x1
>>>>>>>> movi_i64 npc,$0x11fe9f4
>>>>>>>> br $0x2
>>>>>>>> set_label $0x1
>>>>>>>> movi_i64 npc,$0x11fea30
>>>>>>>> set_label $0x2
>>>>>>>> movi_i64 tmp8,$wrpstate
>>>>>>>> call tmp8,$0x0,$0,tmp0
>>>>>>>> mov_i64 pc,npc
>>>>>>>> movi_i64 tmp8,$0x4
>>>>>>>> add_i64 npc,npc,tmp8
>>>>>>>> exit_tb $0x0
>>>>>>>>
>>>>>>>> OP after liveness analysis:
>>>>>>>> ---- 0x11fea28
>>>>>>>> ld_i64 tmp6,regwptr,$0x20
>>>>>>>> movi_i64 cond,$0x0
>>>>>>>> movi_i64 tmp8,$0x0
>>>>>>>> brcond_i64 tmp6,tmp8,ne,$0x0
>>>>>>>> movi_i64 cond,$0x1
>>>>>>>> set_label $0x0
>>>>>>>>
>>>>>>>> ---- 0x11fea2c
>>>>>>>> nopn $0x2,$0x2
>>>>>>>> nopn $0x3,$0x68,$0x3
>>>>>>>> movi_i64 pc,$0x11fea2c
>>>>>>>> movi_i64 tmp8,$compute_psr
>>>>>>>> call tmp8,$0x0,$0
>>>>>>>> movi_i64 tmp8,$0x0
>>>>>>>> brcond_i64 cond,tmp8,eq,$0x1
>>>>>>>> movi_i64 npc,$0x11fe9f4
>>>>>>>> br $0x2
>>>>>>>> set_label $0x1
>>>>>>>> movi_i64 npc,$0x11fea30
>>>>>>>> set_label $0x2
>>>>>>>> movi_i64 tmp8,$wrpstate
>>>>>>>> call tmp8,$0x0,$0,tmp0
>>>>>>>> mov_i64 pc,npc
>>>>>>>> movi_i64 tmp8,$0x4
>>>>>>>> add_i64 npc,npc,tmp8
>>>>>>>> exit_tb $0x0
>>>>>>>> end
>>>>>>>>
>>>>>>>> Does it mean the last block is processed correctly and the crash
>>>>>>>> happens on the next instruction which doesn't make it to the log?
>>>>>>>> The next instruction would be a
>>>>>>>>
>>>>>>>> 0x00000000011fea30: retl
>>>>>>>>
>>>>>>>> Since it's a branch instruction I guess this would also be a tcg block boundary.
>>>>>>>
>>>>>>> Because abort() was called from tcg_reg_alloc_call, I'd say 'retl'
>>>>>>> (synthetic op for 'jmpl %o8 + 8, %g0') was the problem.
>>>>>>
>>>>>> Any idea why? retl is not a rare instruction...
>>>>>
>>>>> Sorry, calls are generated for helpers, so it's not 'jmpl' but the
>>>>> call to wrpstate helper.
>>>>
>>>> And why it doesn't happen in a singlestep mode?
>>>> I tried to comment out
>>>> cpu_check_irqs(env);
>>>> in the helper_wrpstate but it made no difference. The only suspicious
>>>> thing left is register bank switching. Is it safe to switch register
>>>> banks in the helper function? Shouldn't we end the translation block
>>>> before?
>>>
>>> Not sure if I have seen write to pstate in delay slot, but switching
>>> globals with PS_AG appears to be safe.
>>> Do you know which bits are changed in the pstate?
>>
>> Hard to say. With a breakpoint set qemu doesn't crash.
>> The breakpoint shows the change from 0x14->0x16.
>> So the only difference is that interrupts are getting enabled. No
>> register bank change.
>> (And now also no cpu_check_irqs(env) call, because I commented it out.)
>>
>> But given there was a Data Access MMU Miss, I would expect there must
>> have beeb a PS_MG switch.
>>
>> Also the breakpoint makes tcg to cut the translation block before the wrpr:
>>
>> IN:
>> 0x00000000011fea18: rdpr %tick, %o5
>> 0x00000000011fea1c: cmp %o2, %o4
>> 0x00000000011fea20: be %icc, 0x11fea18
>> 0x00000000011fea24: ldub [ %o0 ], %o4
>> --------------
>> IN:
>> 0x00000000011fea28: brz,pn %o4, 0x11fe9f4
>> --------------
>> IN:
>> 0x00000000011fea2c: wrpr %g0, %g1, %pstate
>> --------------
>> IN:
>> 0x00000000011fea30: retl
>> --------------
>> IN:
>> 0x00000000011fea30: retl
>> 0x00000000011fea34: sub %o5, %o3, %o0
>>
>
> You can try enabling DEBUG_PSTATE to see which bits are changed.
I put an additional DPRINTF in the helper and it doesn't get executed
at 11fea2c. Only at 11fe9f4 (0x16->0x14).
--
Regards,
Artyom Tarasenko
solaris/sparc under qemu blog: http://tyom.blogspot.com/
^ permalink raw reply
* [PATCH] xfstests: allow deeper symlink recursion in 005
From: Christoph Hellwig @ 2011-04-10 20:03 UTC (permalink / raw)
To: xfs
Recent kernels allow more than 40 nested symlinks, so up the limit
to still reproduce a failure.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: xfstests-dev/005
===================================================================
--- xfstests-dev.orig/005 2011-03-16 13:10:39.000000000 +0000
+++ xfstests-dev/005 2011-03-16 13:11:00.000000000 +0000
@@ -45,7 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 1
_cleanup()
{
cd $testdir
- rm -f symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9} symlink_self empty_file
+ rm -f symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9} symlink_self empty_file
cd /
_cleanup_testdir
}
@@ -82,7 +82,7 @@ cd $testdir
o=empty_file
touch $o
-for f in symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
+for f in symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
do
ln -s $o $f
o=$f
@@ -92,7 +92,7 @@ ln -s symlink_self symlink_self
echo "*** touch deep symlinks"
echo ""
-_touch symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
+_touch symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
echo ""
echo "*** touch recusive symlinks"
echo ""
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.