All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch
@ 2016-06-14  9:52 Peter Maydell
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI Peter Maydell
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Peter Maydell @ 2016-06-14  9:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Richard Henderson

The main aim of this patchset is to fix a problem with the dependency
handling of the hostdep.h files added in in commit 4d330cee37a21.
It needs to be applied before we add any more architecture-specific
hostdep.h files (ie before rth's patchset for ppc/arm/i386/s390/etc).


The intent of commit 4d330cee3 was that host architectures which needed
a hostdep.h could provide it, and the build system would automatically
fall back to a generic version if there was no version for the host
architecture.  Although this works, it has a flaw: if a subsequent
commit switches an architecture from "uses generic/hostdep.h" to
"uses its own hostdep.h" nothing in the makefile dependencies notices
this and so doing a rebuild without a manual 'make clean' will fail.
    
So we drop the idea of having a 'generic' version in favour of
every architecture we support having its own hostdep.h, even if
it doesn't have anything in it. (There are only thirteen of these.)


There is an oddball corner case for linux-user which is that we were
permitting 'unknown' host architectures in configure even though we
need to know about the host CPU architecture for linux-user to work
(in particular user-exec.c has code for handling signals that needs
to know about that host's context structures).  Cleaning this up
first means we don't need to have a weird and mostly useless
unknown/hostdep.h.  The only two configurations which could in theory
use ARCH=unknown without failing to compile due to missing
user-exec.c support are:
 * linux-user targets on M68K hosts using TCI
 * linux-user targets on HPPA hosts using TCI
    
I doubt anybody is actually trying to use these in practice, though:
 * interpreted TCG on a slow host CPU would be unusably slow
 * the m68k user-exec.c support is missing is_write detection so guest
   code which writes to the same page it is executing from was broken
   (will include any guest program using signals)
 * HPPA TCG backend support was dropped two and a half years ago
   with no complaints

So rather than raising m68k or hppa to "actually known architecture"
this patchset drops support for them entirely as linux-user hosts,
and deletes the now-unused code from user-exec.c. A bonus extra
patch removes some OSX code from user-exec.c which hasn't been used
since we dropped darwin-user.

thanks
-- PMM


Peter Maydell (5):
  configure: Don't override ARCH=unknown if enabling TCI
  configure: Don't allow user-only targets for unknown CPU architectures
  user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code
  user-exec: Remove unused code for OSX hosts
  linux-user: Create a hostdep.h for each host architecture

 Makefile.target                   |   5 +-
 configure                         |   8 ++-
 linux-user/host/aarch64/hostdep.h |  15 ++++++
 linux-user/host/arm/hostdep.h     |  15 ++++++
 linux-user/host/generic/hostdep.h |  20 -------
 linux-user/host/i386/hostdep.h    |  15 ++++++
 linux-user/host/ia64/hostdep.h    |  15 ++++++
 linux-user/host/mips/hostdep.h    |  15 ++++++
 linux-user/host/ppc/hostdep.h     |  15 ++++++
 linux-user/host/ppc64/hostdep.h   |  15 ++++++
 linux-user/host/s390/hostdep.h    |  15 ++++++
 linux-user/host/s390x/hostdep.h   |  15 ++++++
 linux-user/host/sparc/hostdep.h   |  15 ++++++
 linux-user/host/sparc64/hostdep.h |  15 ++++++
 linux-user/host/x32/hostdep.h     |  15 ++++++
 user-exec.c                       | 107 +-------------------------------------
 16 files changed, 189 insertions(+), 131 deletions(-)
 create mode 100644 linux-user/host/aarch64/hostdep.h
 create mode 100644 linux-user/host/arm/hostdep.h
 delete mode 100644 linux-user/host/generic/hostdep.h
 create mode 100644 linux-user/host/i386/hostdep.h
 create mode 100644 linux-user/host/ia64/hostdep.h
 create mode 100644 linux-user/host/mips/hostdep.h
 create mode 100644 linux-user/host/ppc/hostdep.h
 create mode 100644 linux-user/host/ppc64/hostdep.h
 create mode 100644 linux-user/host/s390/hostdep.h
 create mode 100644 linux-user/host/s390x/hostdep.h
 create mode 100644 linux-user/host/sparc/hostdep.h
 create mode 100644 linux-user/host/sparc64/hostdep.h
 create mode 100644 linux-user/host/x32/hostdep.h

-- 
1.9.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI
  2016-06-14  9:52 [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch Peter Maydell
@ 2016-06-14  9:52 ` Peter Maydell
  2016-06-14  9:57   ` Laurent Vivier
  2016-06-14 16:30   ` Richard Henderson
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures Peter Maydell
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 17+ messages in thread
From: Peter Maydell @ 2016-06-14  9:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Richard Henderson

At the moment if configure finds an unknown CPU it will set
ARCH to 'unknown', and then later either bail out or set it
to 'tci' (depending on whether the user passed configure the
--enable-tcg-interpreter switch). This is unnecessarily
confusing, because we could be using TCI in two cases:
 * a known host architecture (in which case ARCH is set to
   the actual host architecture, like 'i386')
 * an unknown host architecture (in which case ARCH is
   set to 'tci')
so nothing can rely on ARCH=tci to mean "using TCI".
Remove the line setting ARCH, so we leave it as "unknown",
which is what the actual situation is.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index 8c2f90b..7ab4e0b 100755
--- a/configure
+++ b/configure
@@ -1381,7 +1381,6 @@ fi
 if test "$ARCH" = "unknown"; then
     if test "$tcg_interpreter" = "yes" ; then
         echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
-        ARCH=tci
     else
         error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
     fi
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures
  2016-06-14  9:52 [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch Peter Maydell
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI Peter Maydell
@ 2016-06-14  9:52 ` Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:31   ` Richard Henderson
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code Peter Maydell
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 17+ messages in thread
From: Peter Maydell @ 2016-06-14  9:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Richard Henderson

For the user-only targets, we need to know something about the host CPU
architecture even if we are using the TCI interpreter rather than TCG.
(In particular user-exec.c has code for handling signals that needs
to know about that host's context structures.)

Specifically forbid building the user-only targets on unknown CPU
architectures, rather than allowing them to configure but then fail
when building user-exec.c.

This change drops supports for two configurations which were theoretically
possible before:
 * linux-user targets on M68K hosts using TCI
 * linux-user targets on HPPA hosts using TCI

We don't think anybody is actually trying to use these in practice, though:
 * interpreted TCG on a slow host CPU would be unusably slow
 * the m68k user-exec.c support is missing is_write detection so guest
   code which writes to the same page it is executing from was broken
   (will include any guest program using signals)
 * HPPA TCG backend support was dropped two and a half years ago
   with no complaints

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configure b/configure
index 7ab4e0b..62f93e3 100755
--- a/configure
+++ b/configure
@@ -1217,6 +1217,13 @@ esac
 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
 
+# For user-mode emulation the host arch has to be one we explicitly
+# support, even if we're using TCI.
+if [ "$ARCH" = "unknown" ]; then
+  bsd_user="no"
+  linux_user="no"
+fi
+
 default_target_list=""
 
 mak_wilds=""
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code
  2016-06-14  9:52 [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch Peter Maydell
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI Peter Maydell
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures Peter Maydell
@ 2016-06-14  9:52 ` Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:32   ` Richard Henderson
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts Peter Maydell
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture Peter Maydell
  4 siblings, 2 replies; 17+ messages in thread
From: Peter Maydell @ 2016-06-14  9:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Richard Henderson

Now that configure blocks attempts to build user-mode code on hppa
and m68k hosts, we can delete the cpu_signal_handler() implementations
for those architectures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 user-exec.c | 60 ------------------------------------------------------------
 1 file changed, 60 deletions(-)

diff --git a/user-exec.c b/user-exec.c
index 50e95a6..1e2449e 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -494,24 +494,6 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
                              is_write, &uc->uc_sigmask);
 }
 
-#elif defined(__mc68000)
-
-int cpu_signal_handler(int host_signum, void *pinfo,
-                       void *puc)
-{
-    siginfo_t *info = pinfo;
-    struct ucontext *uc = puc;
-    unsigned long pc;
-    int is_write;
-
-    pc = uc->uc_mcontext.gregs[16];
-    /* XXX: compute is_write */
-    is_write = 0;
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             is_write,
-                             &uc->uc_sigmask);
-}
-
 #elif defined(__ia64)
 
 #ifndef __ISR_VALID
@@ -616,48 +598,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
                              is_write, &uc->uc_sigmask);
 }
 
-#elif defined(__hppa__)
-
-int cpu_signal_handler(int host_signum, void *pinfo,
-                       void *puc)
-{
-    siginfo_t *info = pinfo;
-    struct ucontext *uc = puc;
-    unsigned long pc = uc->uc_mcontext.sc_iaoq[0];
-    uint32_t insn = *(uint32_t *)pc;
-    int is_write = 0;
-
-    /* XXX: need kernel patch to get write flag faster.  */
-    switch (insn >> 26) {
-    case 0x1a: /* STW */
-    case 0x19: /* STH */
-    case 0x18: /* STB */
-    case 0x1b: /* STWM */
-        is_write = 1;
-        break;
-
-    case 0x09: /* CSTWX, FSTWX, FSTWS */
-    case 0x0b: /* CSTDX, FSTDX, FSTDS */
-        /* Distinguish from coprocessor load ... */
-        is_write = (insn >> 9) & 1;
-        break;
-
-    case 0x03:
-        switch ((insn >> 6) & 15) {
-        case 0xa: /* STWS */
-        case 0x9: /* STHS */
-        case 0x8: /* STBS */
-        case 0xe: /* STWAS */
-        case 0xc: /* STBYS */
-            is_write = 1;
-        }
-        break;
-    }
-
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             is_write, &uc->uc_sigmask);
-}
-
 #else
 
 #error host CPU specific signal handler needed
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts
  2016-06-14  9:52 [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch Peter Maydell
                   ` (2 preceding siblings ...)
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code Peter Maydell
@ 2016-06-14  9:52 ` Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:33   ` Richard Henderson
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture Peter Maydell
  4 siblings, 2 replies; 17+ messages in thread
From: Peter Maydell @ 2016-06-14  9:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Richard Henderson

Since we dropped darwin-user support many years ago, the code in
user-exec to support hosts which define __APPLE__ is unused; delete it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 user-exec.c | 47 +----------------------------------------------
 1 file changed, 1 insertion(+), 46 deletions(-)

diff --git a/user-exec.c b/user-exec.c
index 1e2449e..95f9f97 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -117,14 +117,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 
 #if defined(__i386__)
 
-#if defined(__APPLE__)
-#include <sys/ucontext.h>
-
-#define EIP_sig(context)  (*((unsigned long *)&(context)->uc_mcontext->ss.eip))
-#define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
-#define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
-#define MASK_sig(context)    ((context)->uc_sigmask)
-#elif defined(__NetBSD__)
+#if defined(__NetBSD__)
 #include <ucontext.h>
 
 #define EIP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_EIP])
@@ -274,44 +267,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
 #define TRAP_sig(context)              ((context)->uc_mcontext.mc_exc)
 #endif /* __FreeBSD__|| __FreeBSD_kernel__ */
 
-#ifdef __APPLE__
-#include <sys/ucontext.h>
-typedef struct ucontext SIGCONTEXT;
-/* All Registers access - only for local access */
-#define REG_sig(reg_name, context)              \
-    ((context)->uc_mcontext->ss.reg_name)
-#define FLOATREG_sig(reg_name, context)         \
-    ((context)->uc_mcontext->fs.reg_name)
-#define EXCEPREG_sig(reg_name, context)         \
-    ((context)->uc_mcontext->es.reg_name)
-#define VECREG_sig(reg_name, context)           \
-    ((context)->uc_mcontext->vs.reg_name)
-/* Gpr Registers access */
-#define GPR_sig(reg_num, context)              REG_sig(r##reg_num, context)
-/* Program counter */
-#define IAR_sig(context)                       REG_sig(srr0, context)
-/* Machine State Register (Supervisor) */
-#define MSR_sig(context)                       REG_sig(srr1, context)
-#define CTR_sig(context)                       REG_sig(ctr, context)
-/* Link register */
-#define XER_sig(context)                       REG_sig(xer, context)
-/* User's integer exception register */
-#define LR_sig(context)                        REG_sig(lr, context)
-/* Condition register */
-#define CR_sig(context)                        REG_sig(cr, context)
-/* Float Registers access */
-#define FLOAT_sig(reg_num, context)             \
-    FLOATREG_sig(fpregs[reg_num], context)
-#define FPSCR_sig(context)                      \
-    ((double)FLOATREG_sig(fpscr, context))
-/* Exception Registers access */
-/* Fault registers for coredump */
-#define DAR_sig(context)                       EXCEPREG_sig(dar, context)
-#define DSISR_sig(context)                     EXCEPREG_sig(dsisr, context)
-/* number of powerpc exception taken */
-#define TRAP_sig(context)                      EXCEPREG_sig(exception, context)
-#endif /* __APPLE__ */
-
 int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture
  2016-06-14  9:52 [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch Peter Maydell
                   ` (3 preceding siblings ...)
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts Peter Maydell
@ 2016-06-14  9:52 ` Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:34   ` Richard Henderson
  4 siblings, 2 replies; 17+ messages in thread
From: Peter Maydell @ 2016-06-14  9:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier, Richard Henderson

In commit 4d330cee37a21 a new hostdep.h file was added, with the intent
that host architectures which needed one could provide it, and the
build system would automatically fall back to a generic version if
there was no version for the host architecture. Although this works,
it has a flaw: if a subsequent commit switches an architecture from
"uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the
makefile dependencies notices this and so doing a rebuild without
a manual 'make clean' will fail.

So we drop the idea of having a 'generic' version in favour of
every architecture we support having its own hostdep.h, even if
it doesn't have anything in it. (There are only thirteen of these.)

If the dependency files claim that an object file depends on a
nonexistent file, our dependency system means that make will
rebuild the object file, and regenerate the dependencies in
the process. So moving between trees prior to this commit and
trees after this commit works without requiring a 'make clean'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 Makefile.target                   |  5 +----
 linux-user/host/aarch64/hostdep.h | 15 +++++++++++++++
 linux-user/host/arm/hostdep.h     | 15 +++++++++++++++
 linux-user/host/generic/hostdep.h | 20 --------------------
 linux-user/host/i386/hostdep.h    | 15 +++++++++++++++
 linux-user/host/ia64/hostdep.h    | 15 +++++++++++++++
 linux-user/host/mips/hostdep.h    | 15 +++++++++++++++
 linux-user/host/ppc/hostdep.h     | 15 +++++++++++++++
 linux-user/host/ppc64/hostdep.h   | 15 +++++++++++++++
 linux-user/host/s390/hostdep.h    | 15 +++++++++++++++
 linux-user/host/s390x/hostdep.h   | 15 +++++++++++++++
 linux-user/host/sparc/hostdep.h   | 15 +++++++++++++++
 linux-user/host/sparc64/hostdep.h | 15 +++++++++++++++
 linux-user/host/x32/hostdep.h     | 15 +++++++++++++++
 14 files changed, 181 insertions(+), 24 deletions(-)
 create mode 100644 linux-user/host/aarch64/hostdep.h
 create mode 100644 linux-user/host/arm/hostdep.h
 delete mode 100644 linux-user/host/generic/hostdep.h
 create mode 100644 linux-user/host/i386/hostdep.h
 create mode 100644 linux-user/host/ia64/hostdep.h
 create mode 100644 linux-user/host/mips/hostdep.h
 create mode 100644 linux-user/host/ppc/hostdep.h
 create mode 100644 linux-user/host/ppc64/hostdep.h
 create mode 100644 linux-user/host/s390/hostdep.h
 create mode 100644 linux-user/host/s390x/hostdep.h
 create mode 100644 linux-user/host/sparc/hostdep.h
 create mode 100644 linux-user/host/sparc64/hostdep.h
 create mode 100644 linux-user/host/x32/hostdep.h

diff --git a/Makefile.target b/Makefile.target
index 495b474..b156799 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -108,11 +108,8 @@ obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o
 
 ifdef CONFIG_LINUX_USER
 
-# Note that we only add linux-user/host/$ARCH if it exists, and
-# that it must come before linux-user/host/generic in the search path.
 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
-             $(patsubst %,-I%,$(wildcard $(SRC_PATH)/linux-user/host/$(ARCH))) \
-             -I$(SRC_PATH)/linux-user/host/generic \
+             -I$(SRC_PATH)/linux-user/host/$(ARCH) \
              -I$(SRC_PATH)/linux-user
 
 obj-y += linux-user/
diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/aarch64/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/arm/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/generic/hostdep.h b/linux-user/host/generic/hostdep.h
deleted file mode 100644
index cfabc35..0000000
--- a/linux-user/host/generic/hostdep.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * hostdep.h : fallback generic version of header for things
- * which are dependent on the host architecture
- *
- *  * Written by Peter Maydell <peter.maydell@linaro.org>
- *
- * Copyright (C) 2016 Linaro Limited
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#ifndef QEMU_HOSTDEP_H
-#define QEMU_HOSTDEP_H
-
-/* This is the fallback header which is only used if the host
- * architecture doesn't provide one in linux-user/host/$ARCH.
- */
-
-#endif
diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/i386/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/ia64/hostdep.h b/linux-user/host/ia64/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/ia64/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/mips/hostdep.h b/linux-user/host/mips/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/mips/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/ppc/hostdep.h b/linux-user/host/ppc/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/ppc/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/ppc64/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/s390/hostdep.h b/linux-user/host/s390/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/s390/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/s390x/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/sparc/hostdep.h b/linux-user/host/sparc/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/sparc/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/sparc64/hostdep.h b/linux-user/host/sparc64/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/sparc64/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
diff --git a/linux-user/host/x32/hostdep.h b/linux-user/host/x32/hostdep.h
new file mode 100644
index 0000000..7609bf5
--- /dev/null
+++ b/linux-user/host/x32/hostdep.h
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <peter.maydell@linaro.org>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI Peter Maydell
@ 2016-06-14  9:57   ` Laurent Vivier
  2016-06-14  9:59     ` Laurent Vivier
  2016-06-14 16:30   ` Richard Henderson
  1 sibling, 1 reply; 17+ messages in thread
From: Laurent Vivier @ 2016-06-14  9:57 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Richard Henderson



Le 14/06/2016 à 11:52, Peter Maydell a écrit :
> At the moment if configure finds an unknown CPU it will set
> ARCH to 'unknown', and then later either bail out or set it
> to 'tci' (depending on whether the user passed configure the
> --enable-tcg-interpreter switch). This is unnecessarily
> confusing, because we could be using TCI in two cases:
>  * a known host architecture (in which case ARCH is set to
>    the actual host architecture, like 'i386')
>  * an unknown host architecture (in which case ARCH is
>    set to 'tci')
> so nothing can rely on ARCH=tci to mean "using TCI".
> Remove the line setting ARCH, so we leave it as "unknown",
> which is what the actual situation is.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <lvivier@redhat.com>

> ---
>  configure | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 8c2f90b..7ab4e0b 100755
> --- a/configure
> +++ b/configure
> @@ -1381,7 +1381,6 @@ fi
>  if test "$ARCH" = "unknown"; then
>      if test "$tcg_interpreter" = "yes" ; then
>          echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
> -        ARCH=tci
>      else
>          error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
>      fi
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures Peter Maydell
@ 2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:31   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Laurent Vivier @ 2016-06-14  9:58 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Richard Henderson



Le 14/06/2016 à 11:52, Peter Maydell a écrit :
> For the user-only targets, we need to know something about the host CPU
> architecture even if we are using the TCI interpreter rather than TCG.
> (In particular user-exec.c has code for handling signals that needs
> to know about that host's context structures.)
> 
> Specifically forbid building the user-only targets on unknown CPU
> architectures, rather than allowing them to configure but then fail
> when building user-exec.c.
> 
> This change drops supports for two configurations which were theoretically
> possible before:
>  * linux-user targets on M68K hosts using TCI
>  * linux-user targets on HPPA hosts using TCI
> 
> We don't think anybody is actually trying to use these in practice, though:
>  * interpreted TCG on a slow host CPU would be unusably slow
>  * the m68k user-exec.c support is missing is_write detection so guest
>    code which writes to the same page it is executing from was broken
>    (will include any guest program using signals)
>  * HPPA TCG backend support was dropped two and a half years ago
>    with no complaints
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  configure | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/configure b/configure
> index 7ab4e0b..62f93e3 100755
> --- a/configure
> +++ b/configure
> @@ -1217,6 +1217,13 @@ esac
>  QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
>  EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
>  
> +# For user-mode emulation the host arch has to be one we explicitly
> +# support, even if we're using TCI.
> +if [ "$ARCH" = "unknown" ]; then
> +  bsd_user="no"
> +  linux_user="no"
> +fi
> +
>  default_target_list=""
>  
>  mak_wilds=""
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code Peter Maydell
@ 2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:32   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Laurent Vivier @ 2016-06-14  9:58 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Richard Henderson



Le 14/06/2016 à 11:52, Peter Maydell a écrit :
> Now that configure blocks attempts to build user-mode code on hppa
> and m68k hosts, we can delete the cpu_signal_handler() implementations
> for those architectures.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  user-exec.c | 60 ------------------------------------------------------------
>  1 file changed, 60 deletions(-)
> 
> diff --git a/user-exec.c b/user-exec.c
> index 50e95a6..1e2449e 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -494,24 +494,6 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
>                               is_write, &uc->uc_sigmask);
>  }
>  
> -#elif defined(__mc68000)
> -
> -int cpu_signal_handler(int host_signum, void *pinfo,
> -                       void *puc)
> -{
> -    siginfo_t *info = pinfo;
> -    struct ucontext *uc = puc;
> -    unsigned long pc;
> -    int is_write;
> -
> -    pc = uc->uc_mcontext.gregs[16];
> -    /* XXX: compute is_write */
> -    is_write = 0;
> -    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
> -                             is_write,
> -                             &uc->uc_sigmask);
> -}
> -
>  #elif defined(__ia64)
>  
>  #ifndef __ISR_VALID
> @@ -616,48 +598,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>                               is_write, &uc->uc_sigmask);
>  }
>  
> -#elif defined(__hppa__)
> -
> -int cpu_signal_handler(int host_signum, void *pinfo,
> -                       void *puc)
> -{
> -    siginfo_t *info = pinfo;
> -    struct ucontext *uc = puc;
> -    unsigned long pc = uc->uc_mcontext.sc_iaoq[0];
> -    uint32_t insn = *(uint32_t *)pc;
> -    int is_write = 0;
> -
> -    /* XXX: need kernel patch to get write flag faster.  */
> -    switch (insn >> 26) {
> -    case 0x1a: /* STW */
> -    case 0x19: /* STH */
> -    case 0x18: /* STB */
> -    case 0x1b: /* STWM */
> -        is_write = 1;
> -        break;
> -
> -    case 0x09: /* CSTWX, FSTWX, FSTWS */
> -    case 0x0b: /* CSTDX, FSTDX, FSTDS */
> -        /* Distinguish from coprocessor load ... */
> -        is_write = (insn >> 9) & 1;
> -        break;
> -
> -    case 0x03:
> -        switch ((insn >> 6) & 15) {
> -        case 0xa: /* STWS */
> -        case 0x9: /* STHS */
> -        case 0x8: /* STBS */
> -        case 0xe: /* STWAS */
> -        case 0xc: /* STBYS */
> -            is_write = 1;
> -        }
> -        break;
> -    }
> -
> -    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
> -                             is_write, &uc->uc_sigmask);
> -}
> -
>  #else
>  
>  #error host CPU specific signal handler needed
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts Peter Maydell
@ 2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:33   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Laurent Vivier @ 2016-06-14  9:58 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Richard Henderson



Le 14/06/2016 à 11:52, Peter Maydell a écrit :
> Since we dropped darwin-user support many years ago, the code in
> user-exec to support hosts which define __APPLE__ is unused; delete it.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  user-exec.c | 47 +----------------------------------------------
>  1 file changed, 1 insertion(+), 46 deletions(-)
> 
> diff --git a/user-exec.c b/user-exec.c
> index 1e2449e..95f9f97 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -117,14 +117,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
>  
>  #if defined(__i386__)
>  
> -#if defined(__APPLE__)
> -#include <sys/ucontext.h>
> -
> -#define EIP_sig(context)  (*((unsigned long *)&(context)->uc_mcontext->ss.eip))
> -#define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
> -#define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
> -#define MASK_sig(context)    ((context)->uc_sigmask)
> -#elif defined(__NetBSD__)
> +#if defined(__NetBSD__)
>  #include <ucontext.h>
>  
>  #define EIP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_EIP])
> @@ -274,44 +267,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>  #define TRAP_sig(context)              ((context)->uc_mcontext.mc_exc)
>  #endif /* __FreeBSD__|| __FreeBSD_kernel__ */
>  
> -#ifdef __APPLE__
> -#include <sys/ucontext.h>
> -typedef struct ucontext SIGCONTEXT;
> -/* All Registers access - only for local access */
> -#define REG_sig(reg_name, context)              \
> -    ((context)->uc_mcontext->ss.reg_name)
> -#define FLOATREG_sig(reg_name, context)         \
> -    ((context)->uc_mcontext->fs.reg_name)
> -#define EXCEPREG_sig(reg_name, context)         \
> -    ((context)->uc_mcontext->es.reg_name)
> -#define VECREG_sig(reg_name, context)           \
> -    ((context)->uc_mcontext->vs.reg_name)
> -/* Gpr Registers access */
> -#define GPR_sig(reg_num, context)              REG_sig(r##reg_num, context)
> -/* Program counter */
> -#define IAR_sig(context)                       REG_sig(srr0, context)
> -/* Machine State Register (Supervisor) */
> -#define MSR_sig(context)                       REG_sig(srr1, context)
> -#define CTR_sig(context)                       REG_sig(ctr, context)
> -/* Link register */
> -#define XER_sig(context)                       REG_sig(xer, context)
> -/* User's integer exception register */
> -#define LR_sig(context)                        REG_sig(lr, context)
> -/* Condition register */
> -#define CR_sig(context)                        REG_sig(cr, context)
> -/* Float Registers access */
> -#define FLOAT_sig(reg_num, context)             \
> -    FLOATREG_sig(fpregs[reg_num], context)
> -#define FPSCR_sig(context)                      \
> -    ((double)FLOATREG_sig(fpscr, context))
> -/* Exception Registers access */
> -/* Fault registers for coredump */
> -#define DAR_sig(context)                       EXCEPREG_sig(dar, context)
> -#define DSISR_sig(context)                     EXCEPREG_sig(dsisr, context)
> -/* number of powerpc exception taken */
> -#define TRAP_sig(context)                      EXCEPREG_sig(exception, context)
> -#endif /* __APPLE__ */
> -
>  int cpu_signal_handler(int host_signum, void *pinfo,
>                         void *puc)
>  {
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture Peter Maydell
@ 2016-06-14  9:58   ` Laurent Vivier
  2016-06-14 16:34   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Laurent Vivier @ 2016-06-14  9:58 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Richard Henderson



Le 14/06/2016 à 11:52, Peter Maydell a écrit :
> In commit 4d330cee37a21 a new hostdep.h file was added, with the intent
> that host architectures which needed one could provide it, and the
> build system would automatically fall back to a generic version if
> there was no version for the host architecture. Although this works,
> it has a flaw: if a subsequent commit switches an architecture from
> "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the
> makefile dependencies notices this and so doing a rebuild without
> a manual 'make clean' will fail.
> 
> So we drop the idea of having a 'generic' version in favour of
> every architecture we support having its own hostdep.h, even if
> it doesn't have anything in it. (There are only thirteen of these.)
> 
> If the dependency files claim that an object file depends on a
> nonexistent file, our dependency system means that make will
> rebuild the object file, and regenerate the dependencies in
> the process. So moving between trees prior to this commit and
> trees after this commit works without requiring a 'make clean'.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  Makefile.target                   |  5 +----
>  linux-user/host/aarch64/hostdep.h | 15 +++++++++++++++
>  linux-user/host/arm/hostdep.h     | 15 +++++++++++++++
>  linux-user/host/generic/hostdep.h | 20 --------------------
>  linux-user/host/i386/hostdep.h    | 15 +++++++++++++++
>  linux-user/host/ia64/hostdep.h    | 15 +++++++++++++++
>  linux-user/host/mips/hostdep.h    | 15 +++++++++++++++
>  linux-user/host/ppc/hostdep.h     | 15 +++++++++++++++
>  linux-user/host/ppc64/hostdep.h   | 15 +++++++++++++++
>  linux-user/host/s390/hostdep.h    | 15 +++++++++++++++
>  linux-user/host/s390x/hostdep.h   | 15 +++++++++++++++
>  linux-user/host/sparc/hostdep.h   | 15 +++++++++++++++
>  linux-user/host/sparc64/hostdep.h | 15 +++++++++++++++
>  linux-user/host/x32/hostdep.h     | 15 +++++++++++++++
>  14 files changed, 181 insertions(+), 24 deletions(-)
>  create mode 100644 linux-user/host/aarch64/hostdep.h
>  create mode 100644 linux-user/host/arm/hostdep.h
>  delete mode 100644 linux-user/host/generic/hostdep.h
>  create mode 100644 linux-user/host/i386/hostdep.h
>  create mode 100644 linux-user/host/ia64/hostdep.h
>  create mode 100644 linux-user/host/mips/hostdep.h
>  create mode 100644 linux-user/host/ppc/hostdep.h
>  create mode 100644 linux-user/host/ppc64/hostdep.h
>  create mode 100644 linux-user/host/s390/hostdep.h
>  create mode 100644 linux-user/host/s390x/hostdep.h
>  create mode 100644 linux-user/host/sparc/hostdep.h
>  create mode 100644 linux-user/host/sparc64/hostdep.h
>  create mode 100644 linux-user/host/x32/hostdep.h
> 
> diff --git a/Makefile.target b/Makefile.target
> index 495b474..b156799 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -108,11 +108,8 @@ obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o
>  
>  ifdef CONFIG_LINUX_USER
>  
> -# Note that we only add linux-user/host/$ARCH if it exists, and
> -# that it must come before linux-user/host/generic in the search path.
>  QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
> -             $(patsubst %,-I%,$(wildcard $(SRC_PATH)/linux-user/host/$(ARCH))) \
> -             -I$(SRC_PATH)/linux-user/host/generic \
> +             -I$(SRC_PATH)/linux-user/host/$(ARCH) \
>               -I$(SRC_PATH)/linux-user
>  
>  obj-y += linux-user/
> diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/aarch64/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/arm/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/generic/hostdep.h b/linux-user/host/generic/hostdep.h
> deleted file mode 100644
> index cfabc35..0000000
> --- a/linux-user/host/generic/hostdep.h
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -/*
> - * hostdep.h : fallback generic version of header for things
> - * which are dependent on the host architecture
> - *
> - *  * Written by Peter Maydell <peter.maydell@linaro.org>
> - *
> - * Copyright (C) 2016 Linaro Limited
> - *
> - * This work is licensed under the terms of the GNU GPL, version 2 or later.
> - * See the COPYING file in the top-level directory.
> - */
> -
> -#ifndef QEMU_HOSTDEP_H
> -#define QEMU_HOSTDEP_H
> -
> -/* This is the fallback header which is only used if the host
> - * architecture doesn't provide one in linux-user/host/$ARCH.
> - */
> -
> -#endif
> diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/i386/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/ia64/hostdep.h b/linux-user/host/ia64/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/ia64/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/mips/hostdep.h b/linux-user/host/mips/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/mips/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/ppc/hostdep.h b/linux-user/host/ppc/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/ppc/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/ppc64/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/s390/hostdep.h b/linux-user/host/s390/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/s390/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/s390x/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/sparc/hostdep.h b/linux-user/host/sparc/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/sparc/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/sparc64/hostdep.h b/linux-user/host/sparc64/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/sparc64/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> diff --git a/linux-user/host/x32/hostdep.h b/linux-user/host/x32/hostdep.h
> new file mode 100644
> index 0000000..7609bf5
> --- /dev/null
> +++ b/linux-user/host/x32/hostdep.h
> @@ -0,0 +1,15 @@
> +/*
> + * hostdep.h : things which are dependent on the host architecture
> + *
> + *  * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * Copyright (C) 2016 Linaro Limited
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_HOSTDEP_H
> +#define QEMU_HOSTDEP_H
> +
> +#endif
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI
  2016-06-14  9:57   ` Laurent Vivier
@ 2016-06-14  9:59     ` Laurent Vivier
  0 siblings, 0 replies; 17+ messages in thread
From: Laurent Vivier @ 2016-06-14  9:59 UTC (permalink / raw)
  To: qemu-devel



Le 14/06/2016 à 11:57, Laurent Vivier a écrit :
> 
> 
> Le 14/06/2016 à 11:52, Peter Maydell a écrit :
>> At the moment if configure finds an unknown CPU it will set
>> ARCH to 'unknown', and then later either bail out or set it
>> to 'tci' (depending on whether the user passed configure the
>> --enable-tcg-interpreter switch). This is unnecessarily
>> confusing, because we could be using TCI in two cases:
>>  * a known host architecture (in which case ARCH is set to
>>    the actual host architecture, like 'i386')
>>  * an unknown host architecture (in which case ARCH is
>>    set to 'tci')
>> so nothing can rely on ARCH=tci to mean "using TCI".
>> Remove the line setting ARCH, so we leave it as "unknown",
>> which is what the actual situation is.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> 
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>

oops...

To match the email address:

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Thansk,
Laurent
> 
>> ---
>>  configure | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 8c2f90b..7ab4e0b 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1381,7 +1381,6 @@ fi
>>  if test "$ARCH" = "unknown"; then
>>      if test "$tcg_interpreter" = "yes" ; then
>>          echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
>> -        ARCH=tci
>>      else
>>          error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
>>      fi
>>
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI Peter Maydell
  2016-06-14  9:57   ` Laurent Vivier
@ 2016-06-14 16:30   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Henderson @ 2016-06-14 16:30 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier

On 06/14/2016 02:52 AM, Peter Maydell wrote:
> At the moment if configure finds an unknown CPU it will set
> ARCH to 'unknown', and then later either bail out or set it
> to 'tci' (depending on whether the user passed configure the
> --enable-tcg-interpreter switch). This is unnecessarily
> confusing, because we could be using TCI in two cases:
>  * a known host architecture (in which case ARCH is set to
>    the actual host architecture, like 'i386')
>  * an unknown host architecture (in which case ARCH is
>    set to 'tci')
> so nothing can rely on ARCH=tci to mean "using TCI".
> Remove the line setting ARCH, so we leave it as "unknown",
> which is what the actual situation is.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  configure | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
@ 2016-06-14 16:31   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Henderson @ 2016-06-14 16:31 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier

On 06/14/2016 02:52 AM, Peter Maydell wrote:
> For the user-only targets, we need to know something about the host CPU
> architecture even if we are using the TCI interpreter rather than TCG.
> (In particular user-exec.c has code for handling signals that needs
> to know about that host's context structures.)
> 
> Specifically forbid building the user-only targets on unknown CPU
> architectures, rather than allowing them to configure but then fail
> when building user-exec.c.
> 
> This change drops supports for two configurations which were theoretically
> possible before:
>  * linux-user targets on M68K hosts using TCI
>  * linux-user targets on HPPA hosts using TCI
> 
> We don't think anybody is actually trying to use these in practice, though:
>  * interpreted TCG on a slow host CPU would be unusably slow
>  * the m68k user-exec.c support is missing is_write detection so guest
>    code which writes to the same page it is executing from was broken
>    (will include any guest program using signals)
>  * HPPA TCG backend support was dropped two and a half years ago
>    with no complaints
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  configure | 7 +++++++
>  1 file changed, 7 insertions(+)


Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
@ 2016-06-14 16:32   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Henderson @ 2016-06-14 16:32 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier

On 06/14/2016 02:52 AM, Peter Maydell wrote:
> Now that configure blocks attempts to build user-mode code on hppa
> and m68k hosts, we can delete the cpu_signal_handler() implementations
> for those architectures.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  user-exec.c | 60 ------------------------------------------------------------
>  1 file changed, 60 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
@ 2016-06-14 16:33   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Henderson @ 2016-06-14 16:33 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier

On 06/14/2016 02:52 AM, Peter Maydell wrote:
> Since we dropped darwin-user support many years ago, the code in
> user-exec to support hosts which define __APPLE__ is unused; delete it.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  user-exec.c | 47 +----------------------------------------------
>  1 file changed, 1 insertion(+), 46 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture
  2016-06-14  9:52 ` [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture Peter Maydell
  2016-06-14  9:58   ` Laurent Vivier
@ 2016-06-14 16:34   ` Richard Henderson
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Henderson @ 2016-06-14 16:34 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches, Riku Voipio, Laurent Vivier

On 06/14/2016 02:52 AM, Peter Maydell wrote:
> In commit 4d330cee37a21 a new hostdep.h file was added, with the intent
> that host architectures which needed one could provide it, and the
> build system would automatically fall back to a generic version if
> there was no version for the host architecture. Although this works,
> it has a flaw: if a subsequent commit switches an architecture from
> "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the
> makefile dependencies notices this and so doing a rebuild without
> a manual 'make clean' will fail.
> 
> So we drop the idea of having a 'generic' version in favour of
> every architecture we support having its own hostdep.h, even if
> it doesn't have anything in it. (There are only thirteen of these.)
> 
> If the dependency files claim that an object file depends on a
> nonexistent file, our dependency system means that make will
> rebuild the object file, and regenerate the dependencies in
> the process. So moving between trees prior to this commit and
> trees after this commit works without requiring a 'make clean'.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-06-14 16:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14  9:52 [Qemu-devel] [PATCH 0/5] linux-user: fix dependencies, forbid unknown host arch Peter Maydell
2016-06-14  9:52 ` [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI Peter Maydell
2016-06-14  9:57   ` Laurent Vivier
2016-06-14  9:59     ` Laurent Vivier
2016-06-14 16:30   ` Richard Henderson
2016-06-14  9:52 ` [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures Peter Maydell
2016-06-14  9:58   ` Laurent Vivier
2016-06-14 16:31   ` Richard Henderson
2016-06-14  9:52 ` [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code Peter Maydell
2016-06-14  9:58   ` Laurent Vivier
2016-06-14 16:32   ` Richard Henderson
2016-06-14  9:52 ` [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts Peter Maydell
2016-06-14  9:58   ` Laurent Vivier
2016-06-14 16:33   ` Richard Henderson
2016-06-14  9:52 ` [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture Peter Maydell
2016-06-14  9:58   ` Laurent Vivier
2016-06-14 16:34   ` Richard Henderson

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.