Skip to contentSkip to conversation

linux-user support for target/xtensa

PATCH Applied Max Filippov 3 participants 22 messages Feb 28, 2018 – Mar 9, 2018 exec and binfmt

v2 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover linux-user support for target/xtensa

Hello,

this series adds linux-user support for target/xtensa.
It starts with a small cleanup for xtensa registers dumping. It adds support for debugging linux-user process with xtensa-linux-gdb (as opposed to xtensa-elf-gdb), which can only access unprivileged registers.
It then enables MTTCG for xtensa.
It continues with a cleanup in linux-user/mmap area making sure that it works correctly with limited 30-bit-wide user address space. It then imports xtensa-specific definitions from the linux kernel, conditionalizes user-only/softmmu-only code and adds handlers for signals exceptions, process/thread creation and core registers dumping.

Changes v1->v2:
- add definition of TARGET_TIOCGPTPEER to linux-user/xtensa/termbits.h
- Cc linux-user maintainers

Max Filippov (11):
target/xtensa: dump correct physical registers target/xtensa: mark register windows in the dump target/xtensa: use correct number of registers in gdbstub target/xtensa: support MTTCG
linux-user: fix mmap/munmap/mprotect/mremap/shmat
linux-user: fix assertion in shmdt
linux-user: fix target_mprotect/target_munmap error return values
linux-user: drop unused target_msync function target/xtensa: add linux-user support qemu-binfmt-conf.sh: add qemu-xtensa
MAINTAINERS: fix W: address for xtensa

 MAINTAINERS                             |   2 +-
 configure                               |   1 +
 default-configs/xtensa-linux-user.mak   |   1 +
 default-configs/xtensaeb-linux-user.mak |   1 +
 include/exec/cpu-all.h                  |   2 +-
 include/exec/cpu_ldst.h                 |  12 +-
 linux-user/elfload.c                    |  58 +++++
 linux-user/main.c                       | 245 ++++++++++++++++++
 linux-user/mmap.c                       |  43 ++--
 linux-user/qemu.h                       |   1 -
 linux-user/signal.c                     | 257 ++++++++++++++++++-
 linux-user/syscall.c                    |  13 +-
 linux-user/syscall_defs.h               |  65 ++++-
 linux-user/xtensa/syscall.h             |   0
 linux-user/xtensa/syscall_nr.h          | 437 ++++++++++++++++++++++++++++++++
 linux-user/xtensa/target_cpu.h          |  22 ++
 linux-user/xtensa/target_elf.h          |  16 ++
 linux-user/xtensa/target_signal.h       |  28 ++
 linux-user/xtensa/target_structs.h      |  28 ++
 linux-user/xtensa/target_syscall.h      |  49 ++++
 linux-user/xtensa/termbits.h            | 328 ++++++++++++++++++++++++
 scripts/qemu-binfmt-conf.sh             |  12 +-
 target/xtensa/Makefile.objs             |   3 +-
 target/xtensa/cpu.c                     |  26 +-
 target/xtensa/cpu.h                     |  60 +++--
 target/xtensa/gdbstub.c                 |  14 +-
 target/xtensa/helper.c                  |  58 ++++-
 target/xtensa/helper.h                  |   4 +
 target/xtensa/op_helper.c               |  50 +++-
 target/xtensa/overlay_tool.h            |  11 +-
 target/xtensa/translate.c               |  99 ++++++--
 31 files changed, 1836 insertions(+), 110 deletions(-)
 create mode 100644 default-configs/xtensa-linux-user.mak
 create mode 100644 default-configs/xtensaeb-linux-user.mak
 create mode 100644 linux-user/xtensa/syscall.h
 create mode 100644 linux-user/xtensa/syscall_nr.h
 create mode 100644 linux-user/xtensa/target_cpu.h
 create mode 100644 linux-user/xtensa/target_elf.h
 create mode 100644 linux-user/xtensa/target_signal.h
 create mode 100644 linux-user/xtensa/target_structs.h
 create mode 100644 linux-user/xtensa/target_syscall.h
 create mode 100644 linux-user/xtensa/termbits.h
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/11 target/xtensa: dump correct physical registers

xtensa_cpu_dump_state outputs CPU physical registers as is, without synchronization from current window. That may result in different values printed for the current window and corresponding physical registers. Synchronize physical registers from window before dumping.

---
 target/xtensa/translate.c | 1 +
 1 file changed, 1 insertion(+)
target/xtensa/translate.c +1 -0
index 671d934ff424..3ad86d4508e4 100644
@@ -1215,6 +1215,7 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f,
                 (i % 4) == 3 ? '\n' : ' ');
     }
 
+    xtensa_sync_phys_from_window(env);
     cpu_fprintf(f, "\n");
 
     for (i = 0; i < env->config->nareg; ++i) {
Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/11 target/xtensa: mark register windows in the dump

In reply to Max Filippov

Add arrows that mark beginning of register windows and position of the current window in the windowed register file.

---
 target/xtensa/translate.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
target/xtensa/translate.c +7 -2
index 3ad86d4508e4..5969d7c3cd96 100644
@@ -1219,8 +1219,13 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f,
     cpu_fprintf(f, "\n");
 
     for (i = 0; i < env->config->nareg; ++i) {
-        cpu_fprintf(f, "AR%02d=%08x%c", i, env->phys_regs[i],
-                (i % 4) == 3 ? '\n' : ' ');
+        cpu_fprintf(f, "AR%02d=%08x ", i, env->phys_regs[i]);
+        if (i % 4 == 3) {
+            bool ws = (env->sregs[WINDOW_START] & (1 << (i / 4))) != 0;
+            bool cw = env->sregs[WINDOW_BASE] == i / 4;
+
+            cpu_fprintf(f, "%c%c\n", ws ? '<' : ' ', cw ? '=' : ' ');
+        }
     }
 
     if (xtensa_option_enabled(env->config, XTENSA_OPTION_FP_COPROCESSOR)) {
Signature · 1 line
2.11.0
#3 lore raw

PATCH v2 3/11 target/xtensa: use correct number of registers in gdbstub

In reply to Max Filippov

System emulation should provide access to all registers, userspace emulation should only provide access to unprivileged registers. Record register flags from GDB register map definition, calculate both num_regs and num_core_regs if either is zero. Use num_regs in system emulation, num_core_regs in userspace emulation gdbstub.

---
 target/xtensa/cpu.h          |  1 +
 target/xtensa/gdbstub.c      | 14 ++++++++++++--
 target/xtensa/helper.c       | 28 ++++++++++++++++++++--------
 target/xtensa/overlay_tool.h | 11 ++++++++---
 4 files changed, 41 insertions(+), 13 deletions(-)
target/xtensa/cpu.h +1 -0
index 49c2e3cf9a1b..255cc9e08ed9 100644
@@ -310,6 +310,7 @@ typedef struct xtensa_tlb {
 
 typedef struct XtensaGdbReg {
     int targno;
+    unsigned flags;
     int type;
     int group;
     unsigned size;
target/xtensa/gdbstub.c +12 -2
index d78a1b437dbf..a8ea98d03fb8 100644
@@ -28,9 +28,14 @@ int xtensa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
     XtensaCPU *cpu = XTENSA_CPU(cs);
     CPUXtensaState *env = &cpu->env;
     const XtensaGdbReg *reg = env->config->gdb_regmap.reg + n;
+#ifdef CONFIG_USER_ONLY
+    int num_regs = env->config->gdb_regmap.num_core_regs;
+#else
+    int num_regs = env->config->gdb_regmap.num_regs;
+#endif
     unsigned i;
 
-    if (n < 0 || n >= env->config->gdb_regmap.num_regs) {
+    if (n < 0 || n >= num_regs) {
         return 0;
     }
 
@@ -81,8 +86,13 @@ int xtensa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
     CPUXtensaState *env = &cpu->env;
     uint32_t tmp;
     const XtensaGdbReg *reg = env->config->gdb_regmap.reg + n;
+#ifdef CONFIG_USER_ONLY
+    int num_regs = env->config->gdb_regmap.num_core_regs;
+#else
+    int num_regs = env->config->gdb_regmap.num_regs;
+#endif
 
-    if (n < 0 || n >= env->config->gdb_regmap.num_regs) {
+    if (n < 0 || n >= num_regs) {
         return 0;
     }
 
target/xtensa/helper.c +20 -8
index 5009fecedcb0..34885038d554 100644
@@ -88,19 +88,31 @@ static void init_libisa(XtensaConfig *config)
 
 void xtensa_finalize_config(XtensaConfig *config)
 {
-    unsigned i, n = 0;
-
     if (config->isa_internal) {
         init_libisa(config);
     }
-    if (config->gdb_regmap.num_regs) {
-        return;
-    }
 
-    for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
-        n += (config->gdb_regmap.reg[i].type != 6);
+    if (config->gdb_regmap.num_regs == 0 ||
+        config->gdb_regmap.num_core_regs == 0) {
+        unsigned i;
+        unsigned n_regs = 0;
+        unsigned n_core_regs = 0;
+
+        for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
+            if (config->gdb_regmap.reg[i].type != 6) {
+                ++n_regs;
+                if ((config->gdb_regmap.reg[i].flags & 0x1) == 0) {
+                    ++n_core_regs;
+                }
+            }
+        }
+        if (config->gdb_regmap.num_regs == 0) {
+            config->gdb_regmap.num_regs = n_regs;
+        }
+        if (config->gdb_regmap.num_core_regs == 0) {
+            config->gdb_regmap.num_core_regs = n_core_regs;
+        }
     }
-    config->gdb_regmap.num_regs = n;
 }
 
 void xtensa_register_core(XtensaConfigList *node)
target/xtensa/overlay_tool.h +8 -3
index 589dd6285089..b24ad11fec1c 100644
@@ -25,9 +25,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define XTREG(idx, ofs, bi, sz, al, no, flags, cp, typ, grp, name, \
-        a1, a2, a3, a4, a5, a6) \
-    { .targno = (no), .type = (typ), .group = (grp), .size = (sz) },
+#define XTREG(idx, ofs, bi, sz, al, no, fl, cp, typ, grp, name, \
+              a1, a2, a3, a4, a5, a6) { \
+    .targno = (no), \
+    .flags = (fl), \
+    .type = (typ), \
+    .group = (grp), \
+    .size = (sz), \
+},
 #define XTREG_END { .targno = -1 },
 
 #ifndef XCHAL_HAVE_DEPBITS
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 4/11 target/xtensa: support MTTCG

In reply to Max Filippov

- emit TCG barriers for MEMW, EXTW, S32RI and L32AI;
- do atomic_cmpxchg_i32 for S32C1I.

Cc Emilio G. Cota <[email protected]>
---
 configure                 |  1 +
 target/xtensa/cpu.h       |  3 +++
 target/xtensa/translate.c | 46 +++++++++++++++++++++++++++++++---------------
 3 files changed, 35 insertions(+), 15 deletions(-)
configure +1 -0
index 39f3a4300163..f83bdeb2a550 100755
@@ -6813,6 +6813,7 @@ case "$target_name" in
   ;;
   xtensa|xtensaeb)
     TARGET_ARCH=xtensa
+    mttcg="yes"
   ;;
   *)
     error_exit "Unsupported target CPU"
target/xtensa/cpu.h +3 -0
index 255cc9e08ed9..d9d3b33a7052 100644
@@ -31,6 +31,9 @@
 #define ALIGNED_ONLY
 #define TARGET_LONG_BITS 32
 
+/* Xtensa processors have a weak memory model */
+#define TCG_GUEST_DEFAULT_MO      (0)
+
 #define CPUArchState struct CPUXtensaState
 
 #include "qemu-common.h"
target/xtensa/translate.c +31 -15

89 lines not on this page · raw message

Signature · 1 line
2.11.0
#5 lore raw

PATCH v2 5/11 linux-user: fix mmap/munmap/mprotect/mremap/shmat

In reply to Max Filippov

In linux-user QEMU that runs for a target with TARGET_ABI_BITS bigger than L1_MAP_ADDR_SPACE_BITS an assertion in page_set_flags fires when mmap, munmap, mprotect, mremap or shmat is called for an address outside the guest address space. mmap and mprotect should return ENOMEM in such case.

Introduce macro guest_range_valid that verifies if address range is within guest address space and does not wrap around. Use that macro in mmap/munmap/mprotect/mremap/shmat for error checking.

---
 include/exec/cpu-all.h  |  2 +-
 include/exec/cpu_ldst.h | 12 +++++++-----
 linux-user/mmap.c       | 20 +++++++++++++++-----
 linux-user/syscall.c    |  3 +++
 4 files changed, 26 insertions(+), 11 deletions(-)
include/exec/cpu-all.h +1 -1
index 0b141683f095..12bd049997ac 100644
@@ -160,7 +160,7 @@ extern int have_guest_base;
 extern unsigned long reserved_va;
 
 #define GUEST_ADDR_MAX (reserved_va ? reserved_va : \
-                                    (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1)
+                        (2ul << (TARGET_VIRT_ADDR_SPACE_BITS - 1)) - 1)
 #else
 
 #include "exec/hwaddr.h"
include/exec/cpu_ldst.h +7 -5
index 191f2e962a3c..bbf6988bc725 100644
@@ -53,14 +53,16 @@
 
 #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
 #define h2g_valid(x) 1
+#define guest_valid(x) 1
 #else
-#define h2g_valid(x) ({ \
-    unsigned long __guest = (unsigned long)(x) - guest_base; \
-    (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
-    (!reserved_va || (__guest < reserved_va)); \
-})
+#define h2g_valid(x) guest_valid((unsigned long)(x) - guest_base)
+#define guest_valid(x) ((x) <= GUEST_ADDR_MAX)
 #endif
 
+#define guest_range_valid(start, len) \
+    ({unsigned long l = (len); \
+     guest_valid(l) && (start) <= GUEST_ADDR_MAX - l; })
+
 #define h2g_nocheck(x) ({ \
     unsigned long __ret = (unsigned long)(x) - guest_base; \
     (abi_ulong)__ret; \
linux-user/mmap.c +15 -5
index 0fbfd6dff20d..df81f9b803b6 100644
@@ -80,8 +80,9 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
         return -EINVAL;
     len = TARGET_PAGE_ALIGN(len);
     end = start + len;
-    if (end < start)
-        return -EINVAL;
+    if (!guest_range_valid(start, len)) {
+        return -ENOMEM;
+    }
     prot &= PROT_READ | PROT_WRITE | PROT_EXEC;
     if (len == 0)
         return 0;
@@ -481,8 +482,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
 	 * It can fail only on 64-bit host with 32-bit target.
 	 * On any other target/host host mmap() handles this error correctly.
 	 */
-        if ((unsigned long)start + len - 1 > (abi_ulong) -1) {
-            errno = EINVAL;
+        if (!guest_range_valid(start, len)) {
+            errno = ENOMEM;
             goto fail;
         }
 
@@ -622,8 +623,10 @@ int target_munmap(abi_ulong start, abi_ulong len)
     if (start & ~TARGET_PAGE_MASK)
         return -EINVAL;
     len = TARGET_PAGE_ALIGN(len);
-    if (len == 0)
+    if (len == 0 || !guest_range_valid(start, len)) {
         return -EINVAL;
+    }
+
     mmap_lock();
     end = start + len;
     real_start = start & qemu_host_page_mask;
@@ -678,6 +681,13 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
     int prot;
     void *host_addr;
 
+    if (!guest_range_valid(old_addr, old_size) ||
+        ((flags & MREMAP_FIXED) &&
+         !guest_range_valid(new_addr, new_size))) {
+        errno = ENOMEM;
+        return -1;
+    }
+
     mmap_lock();
 
     if (flags & MREMAP_FIXED) {
linux-user/syscall.c +3 -0
index e24f43c4a259..79245e73784f 100644
@@ -4900,6 +4900,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
             return -TARGET_EINVAL;
         }
     }
+    if (!guest_range_valid(shmaddr, shm_info.shm_segsz)) {
+        return -TARGET_EINVAL;
+    }
 
     mmap_lock();
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH v2 6/11 linux-user: fix assertion in shmdt

In reply to Max Filippov

shmdt fails to call mmap_lock/mmap_unlock around page_set_flags, resulting in the following assertion:
page_set_flags: Assertion `have_mmap_lock()' failed.

Wrap shmdt internals into mmap_lock/mmap_unlock.

---
 linux-user/syscall.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
linux-user/syscall.c +7 -1
index 79245e73784f..595b26fdd8f3 100644
@@ -4947,6 +4947,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
 static inline abi_long do_shmdt(abi_ulong shmaddr)
 {
     int i;
+    abi_long rv;
+
+    mmap_lock();
 
     for (i = 0; i < N_SHM_REGIONS; ++i) {
         if (shm_regions[i].in_use && shm_regions[i].start == shmaddr) {
@@ -4955,8 +4958,11 @@ static inline abi_long do_shmdt(abi_ulong shmaddr)
             break;
         }
     }
+    rv = get_errno(shmdt(g2h(shmaddr)));
+
+    mmap_unlock();
 
-    return get_errno(shmdt(g2h(shmaddr)));
+    return rv;
 }
 
 #ifdef TARGET_NR_ipc
Signature · 1 line
2.11.0
Reviewed-by on v2 6/11
#7 lore raw

Re: [Qemu-devel] [PATCH v2 06/11] linux-user: fix assertion in shmdt

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 6 lines

shmdt fails to call mmap_lock/mmap_unlock around page_set_flags, resulting in the following assertion:
page_set_flags: Assertion `have_mmap_lock()' failed.

Wrap shmdt internals into mmap_lock/mmap_unlock.

Quoted 7 lines
---
 linux-user/syscall.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
#8 lore raw

Re: [Qemu-devel] [PATCH v2 06/11] linux-user: fix assertion in shmdt

In reply to Max Filippov

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 6 lines

shmdt fails to call mmap_lock/mmap_unlock around page_set_flags, resulting in the following assertion:
page_set_flags: Assertion `have_mmap_lock()' failed.

Wrap shmdt internals into mmap_lock/mmap_unlock.

Quoted 7 lines
---
 linux-user/syscall.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent

#9 lore raw

PATCH v2 7/11 linux-user: fix target_mprotect/target_munmap error return values

In reply to Max Filippov

target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter.

---
 linux-user/mmap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
linux-user/mmap.c +4 -4
index df81f9b803b6..84b15c9a1699 100644
@@ -77,11 +77,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
 #endif
 
     if ((start & ~TARGET_PAGE_MASK) != 0)
-        return -EINVAL;
+        return -TARGET_EINVAL;
     len = TARGET_PAGE_ALIGN(len);
     end = start + len;
     if (!guest_range_valid(start, len)) {
-        return -ENOMEM;
+        return -TARGET_ENOMEM;
     }
     prot &= PROT_READ | PROT_WRITE | PROT_EXEC;
     if (len == 0)
@@ -621,10 +621,10 @@ int target_munmap(abi_ulong start, abi_ulong len)
            start, len);
 #endif
     if (start & ~TARGET_PAGE_MASK)
-        return -EINVAL;
+        return -TARGET_EINVAL;
     len = TARGET_PAGE_ALIGN(len);
     if (len == 0 || !guest_range_valid(start, len)) {
-        return -EINVAL;
+        return -TARGET_EINVAL;
     }
 
     mmap_lock();
Signature · 1 line
2.11.0
Reviewed-by on v2 7/11
#10 lore raw

Re: [Qemu-devel] [PATCH v2 07/11] linux-user: fix target_mprotect/target_munmap error return values

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 11 lines

target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter.

---
 linux-user/mmap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
#11 lore raw

Re: [Qemu-devel] [PATCH v2 07/11] linux-user: fix target_mprotect/target_munmap error return values

In reply to Max Filippov

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 4 lines

target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter.

Quoted 8 lines
---
 linux-user/mmap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent

#12 lore raw

PATCH v2 8/11 linux-user: drop unused target_msync function

In reply to Max Filippov

target_msync is not used, remove its declaration and implementation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 linux-user/mmap.c | 17 -----------------
 linux-user/qemu.h |  1 -
 2 files changed, 18 deletions(-)
linux-user/mmap.c +0 -17
index 84b15c9a1699..9168a2051c34 100644
@@ -754,20 +754,3 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
     mmap_unlock();
     return new_addr;
 }
-
-int target_msync(abi_ulong start, abi_ulong len, int flags)
-{
-    abi_ulong end;
-
-    if (start & ~TARGET_PAGE_MASK)
-        return -EINVAL;
-    len = TARGET_PAGE_ALIGN(len);
-    end = start + len;
-    if (end < start)
-        return -EINVAL;
-    if (end == start)
-        return 0;
-
-    start &= qemu_host_page_mask;
-    return msync(g2h(start), end - start, flags);
-}
linux-user/qemu.h +0 -1
index f4b4ca72adb0..23712bbca860 100644
@@ -428,7 +428,6 @@ int target_munmap(abi_ulong start, abi_ulong len);
 abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
                        abi_ulong new_size, unsigned long flags,
                        abi_ulong new_addr);
-int target_msync(abi_ulong start, abi_ulong len, int flags);
 extern unsigned long last_brk;
 extern abi_ulong mmap_next_start;
 abi_ulong mmap_find_vma(abi_ulong, abi_ulong);
Signature · 1 line
2.11.0
Reviewed-by on v2 8/11
#13 lore raw

Re: [Qemu-devel] [PATCH v2 08/11] linux-user: drop unused target_msync function

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 9 lines

target_msync is not used, remove its declaration and implementation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 linux-user/mmap.c | 17 -----------------
 linux-user/qemu.h |  1 -
 2 files changed, 18 deletions(-)
#14 lore raw

Re: [Qemu-devel] [PATCH v2 08/11] linux-user: drop unused target_msync function

In reply to Max Filippov

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 10 lines

target_msync is not used, remove its declaration and implementation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 linux-user/mmap.c | 17 -----------------
 linux-user/qemu.h |  1 -
 2 files changed, 18 deletions(-)

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent

#15 lore raw

PATCH v2 9/11 target/xtensa: add linux-user support

In reply to Max Filippov

Import list of syscalls from the kernel source. Conditionalize code/data that is only used with softmmu. Implement exception handlers. Implement signal hander (only the core registers for now, no coprocessors or TIE).

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>

---
Changes v1->v2:
- add definition of TARGET_TIOCGPTPEER to linux-user/xtensa/termbits.h
- Cc linux-user maintainers

 default-configs/xtensa-linux-user.mak   |   1 +
 default-configs/xtensaeb-linux-user.mak |   1 +
 linux-user/elfload.c                    |  58 +++++
 linux-user/main.c                       | 245 ++++++++++++++++++
 linux-user/signal.c                     | 257 ++++++++++++++++++-
 linux-user/syscall.c                    |   2 +
 linux-user/syscall_defs.h               |  65 ++++-
 linux-user/xtensa/syscall.h             |   0
 linux-user/xtensa/syscall_nr.h          | 437 ++++++++++++++++++++++++++++++++
 linux-user/xtensa/target_cpu.h          |  22 ++
 linux-user/xtensa/target_elf.h          |  16 ++
 linux-user/xtensa/target_signal.h       |  28 ++
 linux-user/xtensa/target_structs.h      |  28 ++
 linux-user/xtensa/target_syscall.h      |  49 ++++
 linux-user/xtensa/termbits.h            | 328 ++++++++++++++++++++++++
 target/xtensa/Makefile.objs             |   3 +-
 target/xtensa/cpu.c                     |  26 +-
 target/xtensa/cpu.h                     |  56 ++--
 target/xtensa/helper.c                  |  30 +++
 target/xtensa/helper.h                  |   4 +
 target/xtensa/op_helper.c               |  50 +++-
 target/xtensa/translate.c               |  43 +++-
 22 files changed, 1705 insertions(+), 44 deletions(-)
 create mode 100644 default-configs/xtensa-linux-user.mak
 create mode 100644 default-configs/xtensaeb-linux-user.mak
 create mode 100644 linux-user/xtensa/syscall.h
 create mode 100644 linux-user/xtensa/syscall_nr.h
 create mode 100644 linux-user/xtensa/target_cpu.h
 create mode 100644 linux-user/xtensa/target_elf.h
 create mode 100644 linux-user/xtensa/target_signal.h
 create mode 100644 linux-user/xtensa/target_structs.h
 create mode 100644 linux-user/xtensa/target_syscall.h
 create mode 100644 linux-user/xtensa/termbits.h
default-configs/xtensa-linux-user.mak new file +1 -0
new file mode 100644
index 000000000000..fd1d350ee944
@@ -0,0 +1 @@
+# Default configuration for xtensa-linux-user
default-configs/xtensaeb-linux-user.mak new file +1 -0
new file mode 100644
index 000000000000..fd1d350ee944
@@ -0,0 +1 @@
+# Default configuration for xtensa-linux-user
linux-user/elfload.c +58 -0

64 lines not on this page · raw message

linux-user/main.c +245 -0

257 lines not on this page · raw message

linux-user/signal.c +256 -1

269 lines not on this page · raw message

linux-user/syscall.c +2 -0
index 595b26fdd8f3..d189675a703b 100644
@@ -709,6 +709,8 @@ static inline int regpairs_aligned(void *cpu_env, int num)
         return 0;
     }
 }
+#elif defined(TARGET_XTENSA)
+static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
 #else
 static inline int regpairs_aligned(void *cpu_env, int num) { return 0; }
 #endif
linux-user/syscall_defs.h +62 -3

95 lines not on this page · raw message

linux-user/xtensa/syscall.h new file +0 -0
new file mode 100644
index 000000000000..e69de29bb2d1
linux-user/xtensa/syscall_nr.h new file +437 -0

437 lines not on this page · raw message

linux-user/xtensa/target_cpu.h new file +22 -0
new file mode 100644
index 000000000000..747d82861416
@@ -0,0 +1,22 @@
+/*
+ * Xtensa-specific CPU ABI and functions for linux-user
+ */
+#ifndef XTENSA_TARGET_CPU_H
+#define XTENSA_TARGET_CPU_H
+
+static inline void cpu_clone_regs(CPUXtensaState *env, target_ulong newsp)
+{
+    if (newsp) {
+        env->regs[1] = newsp;
+        env->sregs[WINDOW_BASE] = 0;
+        env->sregs[WINDOW_START] = 0x1;
+    }
+    env->regs[2] = 0;
+}
+
+static inline void cpu_set_tls(CPUXtensaState *env, target_ulong newtls)
+{
+    env->uregs[THREADPTR] = newtls;
+}
+
+#endif
linux-user/xtensa/target_elf.h new file +16 -0
new file mode 100644
index 000000000000..a9a3fabd89be
@@ -0,0 +1,16 @@
+/*
+ * 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, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef XTENSA_TARGET_ELF_H
+#define XTENSA_TARGET_ELF_H
+
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+    return XTENSA_DEFAULT_CPU_MODEL;
+}
+
+#endif
linux-user/xtensa/target_signal.h new file +28 -0
new file mode 100644
index 000000000000..c6962e70afb7
@@ -0,0 +1,28 @@
+#ifndef XTENSA_TARGET_SIGNAL_H
+#define XTENSA_TARGET_SIGNAL_H
+
+#include "cpu.h"
+
+/* this struct defines a stack used during syscall handling */
+
+typedef struct target_sigaltstack {
+    abi_ulong ss_sp;
+    abi_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(CPUXtensaState *state)
+{
+    return state->regs[1];
+}
+
+#endif
linux-user/xtensa/target_structs.h new file +28 -0
new file mode 100644
index 000000000000..020e20e242fc
@@ -0,0 +1,28 @@
+#ifndef XTENSA_TARGET_STRUCTS_T
+#define XTENSA_TARGET_STRUCTS_T
+
+struct target_ipc_perm {
+    abi_int __key;                      /* Key.  */
+    abi_uint uid;                       /* Owner's user ID.  */
+    abi_uint gid;                       /* Owner's group ID.  */
+    abi_uint cuid;                      /* Creator's user ID.  */
+    abi_uint cgid;                      /* Creator's group ID.  */
+    abi_uint mode;                      /* Read/write permission.  */
+    abi_ushort __seq;                   /* Sequence number.  */
+};
+
+struct target_shmid_ds {
+    struct target_ipc_perm shm_perm;    /* operation permission struct */
+    abi_int shm_segsz;                  /* size of segment in bytes */
+    abi_long shm_atime;                 /* time of last shmat() */
+    abi_long shm_dtime;                 /* time of last shmdt() */
+    abi_long shm_ctime;                 /* time of last change by shmctl() */
+    abi_ushort shm_cpid;                /* pid of creator */
+    abi_ushort shm_lpid;                /* pid of last shmop */
+    abi_ushort shm_nattch;              /* number of current attaches */
+    abi_ushort shm_unused;              /* compatibility */
+    abi_ulong __unused2;
+    abi_ulong __unused3;
+};
+
+#endif
linux-user/xtensa/target_syscall.h new file +49 -0

49 lines not on this page · raw message

linux-user/xtensa/termbits.h new file +328 -0

328 lines not on this page · raw message

target/xtensa/Makefile.objs +1 -2
index e15851521f6d..2fae785cb287 100644
@@ -1,10 +1,9 @@
-obj-y += xtensa-semi.o
 obj-y += core-dc232b.o
 obj-y += core-dc233c.o
 obj-y += core-de212.o
 obj-y += core-fsf.o
 obj-y += core-sample_controller.o
-obj-$(CONFIG_SOFTMMU) += monitor.o
+obj-$(CONFIG_SOFTMMU) += monitor.o xtensa-semi.o
 obj-y += xtensa-isa.o
 obj-y += translate.o op_helper.o helper.o cpu.o
 obj-y += gdbstub.o
target/xtensa/cpu.c +22 -4
index 4573388a45fa..2b5b53722265 100644
@@ -45,9 +45,13 @@ static void xtensa_cpu_set_pc(CPUState *cs, vaddr value)
 
 static bool xtensa_cpu_has_work(CPUState *cs)
 {
+#ifndef CONFIG_USER_ONLY
     XtensaCPU *cpu = XTENSA_CPU(cs);
 
     return !cpu->env.runstall && cpu->env.pending_irq_level;
+#else
+    return true;
+#endif
 }
 
 /* CPUClass::reset() */
@@ -62,8 +66,16 @@ static void xtensa_cpu_reset(CPUState *s)
     env->exception_taken = 0;
     env->pc = env->config->exception_vector[EXC_RESET0 + env->static_vectors];
     env->sregs[LITBASE] &= ~1;
+#ifndef CONFIG_USER_ONLY
     env->sregs[PS] = xtensa_option_enabled(env->config,
             XTENSA_OPTION_INTERRUPT) ? 0x1f : 0x10;
+    env->pending_irq_level = 0;
+#else
+    env->sregs[PS] =
+        (xtensa_option_enabled(env->config,
+                               XTENSA_OPTION_WINDOWED_REGISTER) ? PS_WOE : 0) |
+        PS_UM | (3 << PS_RING_SHIFT);
+#endif
     env->sregs[VECBASE] = env->config->vecbase;
     env->sregs[IBREAKENABLE] = 0;
     env->sregs[MEMCTL] = MEMCTL_IL0EN & env->config->memctl_mask;
@@ -73,9 +85,10 @@ static void xtensa_cpu_reset(CPUState *s)
     env->sregs[CONFIGID0] = env->config->configid[0];
     env->sregs[CONFIGID1] = env->config->configid[1];
 
-    env->pending_irq_level = 0;
+#ifndef CONFIG_USER_ONLY
     reset_mmu(env);
     s->halted = env->runstall;
+#endif
 }
 
 static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model)
@@ -104,11 +117,12 @@ static void xtensa_cpu_disas_set_info(CPUState *cs, disassemble_info *info)
 static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cs = CPU(dev);
-    XtensaCPU *cpu = XTENSA_CPU(dev);
     XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev);
     Error *local_err = NULL;
 
-    xtensa_irq_init(&cpu->env);
+#ifndef CONFIG_USER_ONLY
+    xtensa_irq_init(&XTENSA_CPU(dev)->env);
+#endif
 
     cpu_exec_realizefn(cs, &local_err);
     if (local_err != NULL) {
@@ -133,11 +147,13 @@ static void xtensa_cpu_initfn(Object *obj)
     cs->env_ptr = env;
     env->config = xcc->config;
 
+#ifndef CONFIG_USER_ONLY
     env->address_space_er = g_malloc(sizeof(*env->address_space_er));
     env->system_er = g_malloc(sizeof(*env->system_er));
     memory_region_init_io(env->system_er, NULL, NULL, env, "er",
                           UINT64_C(0x100000000));
     address_space_init(env->address_space_er, env->system_er, "ER");
+#endif
 }
 
 static const VMStateDescription vmstate_xtensa_cpu = {
@@ -166,7 +182,9 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
     cc->gdb_read_register = xtensa_cpu_gdb_read_register;
     cc->gdb_write_register = xtensa_cpu_gdb_write_register;
     cc->gdb_stop_before_watchpoint = true;
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_USER_ONLY
+    cc->handle_mmu_fault = xtensa_cpu_handle_mmu_fault;
+#else
     cc->do_unaligned_access = xtensa_cpu_do_unaligned_access;
     cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
     cc->do_unassigned_access = xtensa_cpu_do_unassigned_access;
target/xtensa/cpu.h +37 -19

112 lines not on this page · raw message

target/xtensa/helper.c +30 -0
index 34885038d554..4b20231a95fa 100644
@@ -173,6 +173,7 @@ void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
 
 hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
 {
+#ifndef CONFIG_USER_ONLY
     XtensaCPU *cpu = XTENSA_CPU(cs);
     uint32_t paddr;
     uint32_t page_size;
@@ -187,8 +188,13 @@ hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
         return paddr;
     }
     return ~0;
+#else
+    return addr;
+#endif
 }
 
+#ifndef CONFIG_USER_ONLY
+
 static uint32_t relocated_vector(CPUXtensaState *env, uint32_t vector)
 {
     if (xtensa_option_enabled(env->config,
@@ -298,6 +304,11 @@ void xtensa_cpu_do_interrupt(CPUState *cs)
     }
     check_interrupts(env);
 }
+#else
+void xtensa_cpu_do_interrupt(CPUState *cs)
+{
+}
+#endif
 
 bool xtensa_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
 {
@@ -309,6 +320,24 @@ bool xtensa_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
     return false;
 }
 
+#ifdef CONFIG_USER_ONLY
+
+int xtensa_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
+                                int mmu_idx)
+{
+    XtensaCPU *cpu = XTENSA_CPU(cs);
+    CPUXtensaState *env = &cpu->env;
+
+    qemu_log_mask(CPU_LOG_INT, "%s: rw = %d, address = 0x%08lx, size = %d\n",
+                  __func__, rw, address, size);
+    env->sregs[EXCVADDR] = address;
+    env->sregs[EXCCAUSE] = rw ? STORE_PROHIBITED_CAUSE : LOAD_PROHIBITED_CAUSE;
+    cs->exception_index = EXC_USER;
+    return 1;
+}
+
+#else
+
 static void reset_tlb_mmu_all_ways(CPUXtensaState *env,
         const xtensa_tlb *tlb, xtensa_tlb_entry entry[][MAX_TLB_WAY_SIZE])
 {
@@ -769,3 +798,4 @@ void xtensa_runstall(CPUXtensaState *env, bool runstall)
         cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT);
     }
 }
+#endif
target/xtensa/helper.h +4 -0
index cc751c98fbd0..73444ae02ccd 100644
@@ -12,9 +12,12 @@ DEF_HELPER_1(restore_owb, void, env)
 DEF_HELPER_2(movsp, void, env, i32)
 DEF_HELPER_2(wsr_lbeg, void, env, i32)
 DEF_HELPER_2(wsr_lend, void, env, i32)
+#ifndef CONFIG_USER_ONLY
 DEF_HELPER_1(simcall, void, env)
+#endif
 DEF_HELPER_1(dump_state, void, env)
 
+#ifndef CONFIG_USER_ONLY
 DEF_HELPER_3(waiti, void, env, i32, i32)
 DEF_HELPER_1(update_ccount, void, env)
 DEF_HELPER_2(wsr_ccount, void, env, i32)
@@ -35,6 +38,7 @@ DEF_HELPER_2(wsr_ibreakenable, void, env, i32)
 DEF_HELPER_3(wsr_ibreaka, void, env, i32, i32)
 DEF_HELPER_3(wsr_dbreaka, void, env, i32, i32)
 DEF_HELPER_3(wsr_dbreakc, void, env, i32, i32)
+#endif
 
 DEF_HELPER_2(wur_fcr, void, env, i32)
 DEF_HELPER_FLAGS_1(abs_s, TCG_CALL_NO_RWG_SE, f32, f32)
target/xtensa/op_helper.c +41 -9

131 lines not on this page · raw message

target/xtensa/translate.c +37 -6

178 lines not on this page · raw message

Signature · 1 line
2.11.0
#16 lore raw

PATCH v2 10/11 qemu-binfmt-conf.sh: add qemu-xtensa

In reply to Max Filippov

Register qemu-xtensa and qemu-xtensaeb for transparent linux userspace emulation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 scripts/qemu-binfmt-conf.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
scripts/qemu-binfmt-conf.sh +10 -2
index ea5a7487457c..4efc5812aaa9 100755
@@ -1,10 +1,10 @@
 #!/bin/sh
-# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA
+# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA/Xtensa
 # program execution by the kernel
 
 qemu_target_list="i386 i486 alpha arm armeb sparc32plus ppc ppc64 ppc64le m68k \
 mips mipsel mipsn32 mipsn32el mips64 mips64el \
-sh4 sh4eb s390x aarch64 aarch64_be hppa"
+sh4 sh4eb s390x aarch64 aarch64_be hppa xtensa xtensaeb"
 
 i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00'
 i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
@@ -100,6 +100,14 @@ hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
 hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
 hppa_family=hppa
 
+xtensa_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00'
+xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
+xtensa_family=xtensa
+
+xtensaeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e'
+xtensaeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
+xtensaeb_family=xtensaeb
+
 qemu_get_family() {
     cpu=${HOST_ARCH:-$(uname -m)}
     case "$cpu" in
Signature · 1 line
2.11.0
Reviewed-by on v2 10/11
#17 lore raw

Re: [Qemu-devel] [PATCH v2 10/11] qemu-binfmt-conf.sh: add qemu-xtensa

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 9 lines

Register qemu-xtensa and qemu-xtensaeb for transparent linux userspace emulation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 scripts/qemu-binfmt-conf.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
#18 lore raw

Re: [Qemu-devel] [PATCH v2 10/11] qemu-binfmt-conf.sh: add qemu-xtensa

In reply to Max Filippov

Le 28/02/2018 à 23:16, Max Filippov a écrit :

Quoted 10 lines

Register qemu-xtensa and qemu-xtensaeb for transparent linux userspace emulation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 scripts/qemu-binfmt-conf.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent

#19 lore raw

Re: [Qemu-devel] [PATCH v2 10/11] qemu-binfmt-conf.sh: add qemu-xtensa

Hi Laurent,

Quoted 12 lines · Laurent Vivier
Quoted 10 lines · Max Filippov

Register qemu-xtensa and qemu-xtensaeb for transparent linux userspace emulation.

Cc Riku Voipio <[email protected]>
Cc Laurent Vivier <[email protected]>
---
 scripts/qemu-binfmt-conf.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Quoted 1 line

Applied to my 'linux-user-for-2.12' branch.

could you please also take a look at the patch that adds xtensa linux-user support:
http://lists.nongnu.org/archive/html/qemu-devel/2018-02/msg07348.html

Signature · 2 lines
Thanks.
-- Max
#20 lore raw

PATCH v2 11/11 MAINTAINERS: fix W: address for xtensa

In reply to Max Filippov
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index a334a25e5df0..33c4ef0935dc 100644
@@ -279,7 +279,7 @@ T: git git://github.com/ehabkost/qemu.git x86-next
 
 Xtensa
 M: Max Filippov <[email protected]>
-W: http://wiki.osll.spb.ru/doku.php?id=etc:users:jcmvbkbc:qemu-target-xtensa
+W: http://wiki.osll.ru/doku.php?id=etc:users:jcmvbkbc:qemu-target-xtensa
 S: Maintained
 F: target/xtensa/
 F: hw/xtensa/
Signature · 1 line
2.11.0
#21 lore raw
In reply to Max Filippov
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v2 00/11] linux-user support for target/xtensa

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
dcccaafe47 MAINTAINERS: fix W: address for xtensa
e98bb39328 qemu-binfmt-conf.sh: add qemu-xtensa
c76d7fa337 target/xtensa: add linux-user support
623d335530 linux-user: drop unused target_msync function a482435763 linux-user: fix target_mprotect/target_munmap error return values 1a5815f993 linux-user: fix assertion in shmdt
c126572faf linux-user: fix mmap/munmap/mprotect/mremap/shmat 6394f2caff target/xtensa: support MTTCG
bd2fa3e12c target/xtensa: use correct number of registers in gdbstub 7c57593be6 target/xtensa: mark register windows in the dump 2443667b5c target/xtensa: dump correct physical registers

=== OUTPUT BEGIN ===
Checking PATCH 1/11: target/xtensa: dump correct physical registers... Checking PATCH 2/11: target/xtensa: mark register windows in the dump... Checking PATCH 3/11: target/xtensa: use correct number of registers in gdbstub... Checking PATCH 4/11: target/xtensa: support MTTCG...
Checking PATCH 5/11: linux-user: fix mmap/munmap/mprotect/mremap/shmat... Checking PATCH 6/11: linux-user: fix assertion in shmdt...
Checking PATCH 7/11: linux-user: fix target_mprotect/target_munmap error return values... Checking PATCH 8/11: linux-user: drop unused target_msync function... Checking PATCH 9/11: target/xtensa: add linux-user support...
ERROR: code indent should never use tabs
#677: FILE: linux-user/syscall_defs.h:1396:
+#define TARGET_MAP_FIXED^I0x10^I^I/* Interpret addr exactly */$

ERROR: code indent should never use tabs
#678: FILE: linux-user/syscall_defs.h:1397:
+#define TARGET_MAP_ANONYMOUS^I0x0800^I^I/* don't use a file */$

ERROR: code indent should never use tabs
#679: FILE: linux-user/syscall_defs.h:1398:
+#define TARGET_MAP_GROWSDOWN^I0x1000^I^I/* stack-like segment */$

ERROR: code indent should never use tabs
#680: FILE: linux-user/syscall_defs.h:1399:
+#define TARGET_MAP_DENYWRITE^I0x2000^I^I/* ETXTBSY */$

ERROR: code indent should never use tabs
#681: FILE: linux-user/syscall_defs.h:1400:
+#define TARGET_MAP_EXECUTABLE^I0x4000^I^I/* mark it as an executable */$

ERROR: code indent should never use tabs
#682: FILE: linux-user/syscall_defs.h:1401:
+#define TARGET_MAP_LOCKED^I0x8000^I^I/* pages are locked */$

WARNING: line over 80 characters
#683: FILE: linux-user/syscall_defs.h:1402:
+#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */

ERROR: code indent should never use tabs
#683: FILE: linux-user/syscall_defs.h:1402:
+#define TARGET_MAP_NORESERVE^I0x0400^I^I/* don't check for reservations */$

WARNING: line over 80 characters
#684: FILE: linux-user/syscall_defs.h:1403:
+#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */

ERROR: code indent should never use tabs
#684: FILE: linux-user/syscall_defs.h:1403:
+#define TARGET_MAP_POPULATE^I0x10000^I^I/* populate (prefault) pagetables */$

ERROR: code indent should never use tabs
#685: FILE: linux-user/syscall_defs.h:1404:
+#define TARGET_MAP_NONBLOCK^I0x20000^I^I/* do not block on IO */$

ERROR: code indent should never use tabs
#686: FILE: linux-user/syscall_defs.h:1405:
+#define TARGET_MAP_STACK^I0x40000$

WARNING: line over 80 characters
#848: FILE: linux-user/xtensa/syscall_nr.h:87:
+#define TARGET_NR_utime 64 /* glibc 2.3.3 ?? */

WARNING: line over 80 characters
#950: FILE: linux-user/xtensa/syscall_nr.h:189:
+#define TARGET_NR_reserved152 152 /* set_thread_area */

WARNING: line over 80 characters
#951: FILE: linux-user/xtensa/syscall_nr.h:190:
+#define TARGET_NR_reserved153 153 /* get_thread_area */

WARNING: line over 80 characters
#1669: FILE: linux-user/xtensa/termbits.h:292:
+#define TARGET_TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/

ERROR: line over 90 characters
#1679: FILE: linux-user/xtensa/termbits.h:302:
+#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */

ERROR: space required after that ',' (ctx:VxV)
#1679: FILE: linux-user/xtensa/termbits.h:302:
+#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */

                                    ^

ERROR: space required after that ',' (ctx:VxV)
#1680: FILE: linux-user/xtensa/termbits.h:303:
+#define TARGET_TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */

                                    ^

ERROR: line over 90 characters
#1681: FILE: linux-user/xtensa/termbits.h:304:
+#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */

ERROR: space required after that ',' (ctx:VxV)
#1681: FILE: linux-user/xtensa/termbits.h:304:
+#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */

                                    ^

WARNING: line over 80 characters
#1682: FILE: linux-user/xtensa/termbits.h:305:
+#define TARGET_TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */

ERROR: space required after that ',' (ctx:VxV)
#1682: FILE: linux-user/xtensa/termbits.h:305:
+#define TARGET_TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */

                                    ^

WARNING: line over 80 characters
#1695: FILE: linux-user/xtensa/termbits.h:318:
+#define TARGET_TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */

WARNING: line over 80 characters
#1697: FILE: linux-user/xtensa/termbits.h:320:
+# define TARGET_TIOCSER_TEMT 0x01 /* Transmitter physically empty */

WARNING: line over 80 characters
#1703: FILE: linux-user/xtensa/termbits.h:326:
+#define TARGET_TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */

WARNING: line over 80 characters
#1704: FILE: linux-user/xtensa/termbits.h:327:
+#define TARGET_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */

total: 16 errors, 11 warnings, 2190 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 10/11: qemu-binfmt-conf.sh: add qemu-xtensa...
WARNING: line over 80 characters
#35: FILE: scripts/qemu-binfmt-conf.sh:103:
+xtensa_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00'

ERROR: line over 90 characters
#36: FILE: scripts/qemu-binfmt-conf.sh:104:
+xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'

WARNING: line over 80 characters
#39: FILE: scripts/qemu-binfmt-conf.sh:107:
+xtensaeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e'

ERROR: line over 90 characters
#40: FILE: scripts/qemu-binfmt-conf.sh:108:
+xtensaeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'

total: 2 errors, 2 warnings, 26 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 11/11: MAINTAINERS: fix W: address for xtensa... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]