qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled
@ 2019-07-15 15:22 Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 1/5] target/arm: Always enable CONFIG_SEMIHOSTING Philippe Mathieu-Daudé
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-15 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, Philippe Mathieu-Daudé,
	qemu-arm, Aleksandar Markovic, Paolo Bonzini, James Hogan,
	Alex Bennée, Aurelien Jarno

Amusingly Miroslav and myself hit this issue at the same time.

Note now that "config-devices.h" exists (commit 6c22ea9d83) I could use
#include "config-devices.h" to implement Alex's suggestion to avoid a stub:
https://lists.gnu.org/archive/html/qemu-devel/2019-06/msg03607.html

Some know (arch-specific) limitations are:

- MIPS ITU is accessed by coprocessor instr (ISA feature)
- MIPS timer is accessed by coprocessor instr (ISA feature)
- MIPS semihosting (ISA feature?)
- ARM semihosting (ISA feature?)
- ARMv7 NVIC (device)

This series attempt to fix this the most trivial way, adding
stubs for unreachable code.

Since v1: https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg07267.html
- Always enable semihosting on linux-user

$ git backport-diff -u v1
Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only (new)
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/5:[down] 'target/arm: Always enable CONFIG_SEMIHOSTING'
002/5:[down] 'target/mips: Always enable CONFIG_SEMIHOSTING'
003/5:[down] 'hw/semihosting: Allow this feature to be disabled'
004/5:[0004] [FC] 'target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled'
005/5:[0005] [FC] 'target/mips: Add stubs to build with CONFIG_SEMIHOSTING disabled'

Philippe Mathieu-Daudé (5):
  target/arm: Always enable CONFIG_SEMIHOSTING
  target/mips: Always enable CONFIG_SEMIHOSTING
  hw/semihosting: Allow this feature to be disabled
  target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled
  target/mips: Add stubs to build with CONFIG_SEMIHOSTING disabled

 default-configs/aarch64-linux-user-common.mak |  4 ++++
 default-configs/aarch64-linux-user.mak        |  2 ++
 default-configs/aarch64_be-linux-user.mak     |  2 ++
 default-configs/arm-linux-user-common.mak     |  4 ++++
 default-configs/arm-linux-user.mak            |  2 ++
 default-configs/arm-softmmu.mak               |  4 +++-
 default-configs/armeb-linux-user.mak          |  2 ++
 default-configs/mips-linux-user-common.mak    |  4 ++++
 default-configs/mips-linux-user.mak           |  2 ++
 default-configs/mips-softmmu-common.mak       |  2 +-
 default-configs/mips64-linux-user.mak         |  2 ++
 default-configs/mips64el-linux-user.mak       |  2 ++
 default-configs/mipsel-linux-user.mak         |  2 ++
 default-configs/mipsn32-linux-user.mak        |  2 ++
 default-configs/mipsn32el-linux-user.mak      |  2 ++
 hw/semihosting/Kconfig                        |  3 ++-
 target/arm/Makefile.objs                      |  3 ++-
 target/arm/arm-semi-stubs.c                   | 21 ++++++++++++++++++
 target/mips/Makefile.objs                     |  3 ++-
 target/mips/mips-semi-stubs.c                 | 22 +++++++++++++++++++
 20 files changed, 85 insertions(+), 5 deletions(-)
 create mode 100644 default-configs/aarch64-linux-user-common.mak
 create mode 100644 default-configs/arm-linux-user-common.mak
 create mode 100644 default-configs/mips-linux-user-common.mak
 create mode 100644 target/arm/arm-semi-stubs.c
 create mode 100644 target/mips/mips-semi-stubs.c

-- 
2.20.1



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

* [Qemu-devel] [RFC PATCH-for-4.1? v2 1/5] target/arm: Always enable CONFIG_SEMIHOSTING
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
@ 2019-07-15 15:22 ` Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 2/5] target/mips: " Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-15 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, Philippe Mathieu-Daudé,
	qemu-arm, Aleksandar Markovic, Paolo Bonzini, James Hogan,
	Alex Bennée, Aurelien Jarno

The semihosting feature is always required on user-space, and
is also used by system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 default-configs/aarch64-linux-user-common.mak | 4 ++++
 default-configs/aarch64-linux-user.mak        | 2 ++
 default-configs/aarch64_be-linux-user.mak     | 2 ++
 default-configs/arm-linux-user-common.mak     | 4 ++++
 default-configs/arm-linux-user.mak            | 2 ++
 default-configs/arm-softmmu.mak               | 4 +++-
 default-configs/armeb-linux-user.mak          | 2 ++
 7 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 default-configs/aarch64-linux-user-common.mak
 create mode 100644 default-configs/arm-linux-user-common.mak

diff --git a/default-configs/aarch64-linux-user-common.mak b/default-configs/aarch64-linux-user-common.mak
new file mode 100644
index 0000000000..94c0cdf826
--- /dev/null
+++ b/default-configs/aarch64-linux-user-common.mak
@@ -0,0 +1,4 @@
+# Common aarch64*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
diff --git a/default-configs/aarch64-linux-user.mak b/default-configs/aarch64-linux-user.mak
index 0a5b08a007..d27232cbc6 100644
--- a/default-configs/aarch64-linux-user.mak
+++ b/default-configs/aarch64-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for aarch64-linux-user
+
+include aarch64-linux-user-common.mak
diff --git a/default-configs/aarch64_be-linux-user.mak b/default-configs/aarch64_be-linux-user.mak
index a69d9d2e41..7dee7ba4cb 100644
--- a/default-configs/aarch64_be-linux-user.mak
+++ b/default-configs/aarch64_be-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for aarch64_be-linux-user
+
+include aarch64-linux-user-common.mak
diff --git a/default-configs/arm-linux-user-common.mak b/default-configs/arm-linux-user-common.mak
new file mode 100644
index 0000000000..67acd961f3
--- /dev/null
+++ b/default-configs/arm-linux-user-common.mak
@@ -0,0 +1,4 @@
+# Common arm*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
diff --git a/default-configs/arm-linux-user.mak b/default-configs/arm-linux-user.mak
index 413361a022..7d45e4d20a 100644
--- a/default-configs/arm-linux-user.mak
+++ b/default-configs/arm-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for arm-linux-user
+
+include arm-linux-user-common.mak
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index 1f2e0e7fde..ad2debf543 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -1,5 +1,8 @@
 # Default configuration for arm-softmmu
 
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
+
 # TODO: ARM_V7M is currently always required - make this more flexible!
 CONFIG_ARM_V7M=y
 
@@ -39,4 +42,3 @@ CONFIG_MICROBIT=y
 CONFIG_FSL_IMX25=y
 CONFIG_FSL_IMX7=y
 CONFIG_FSL_IMX6UL=y
-CONFIG_SEMIHOSTING=y
diff --git a/default-configs/armeb-linux-user.mak b/default-configs/armeb-linux-user.mak
index bf2ffe7038..485132f606 100644
--- a/default-configs/armeb-linux-user.mak
+++ b/default-configs/armeb-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for armeb-linux-user
+
+include arm-linux-user-common.mak
-- 
2.20.1



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

* [Qemu-devel] [RFC PATCH-for-4.1? v2 2/5] target/mips: Always enable CONFIG_SEMIHOSTING
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 1/5] target/arm: Always enable CONFIG_SEMIHOSTING Philippe Mathieu-Daudé
@ 2019-07-15 15:22 ` Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 3/5] hw/semihosting: Allow this feature to be disabled Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-15 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, Philippe Mathieu-Daudé,
	qemu-arm, Aleksandar Markovic, Paolo Bonzini, James Hogan,
	Alex Bennée, Aurelien Jarno

The semihosting feature is always required on user-space.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 default-configs/mips-linux-user-common.mak | 4 ++++
 default-configs/mips-linux-user.mak        | 2 ++
 default-configs/mips64-linux-user.mak      | 2 ++
 default-configs/mips64el-linux-user.mak    | 2 ++
 default-configs/mipsel-linux-user.mak      | 2 ++
 default-configs/mipsn32-linux-user.mak     | 2 ++
 default-configs/mipsn32el-linux-user.mak   | 2 ++
 7 files changed, 16 insertions(+)
 create mode 100644 default-configs/mips-linux-user-common.mak

diff --git a/default-configs/mips-linux-user-common.mak b/default-configs/mips-linux-user-common.mak
new file mode 100644
index 0000000000..04947706e8
--- /dev/null
+++ b/default-configs/mips-linux-user-common.mak
@@ -0,0 +1,4 @@
+# Common mips*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
diff --git a/default-configs/mips-linux-user.mak b/default-configs/mips-linux-user.mak
index 31df57021e..c606e12444 100644
--- a/default-configs/mips-linux-user.mak
+++ b/default-configs/mips-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for mips-linux-user
+
+include mips-linux-user-common.mak
diff --git a/default-configs/mips64-linux-user.mak b/default-configs/mips64-linux-user.mak
index 1598bfcf7d..81e16ac2eb 100644
--- a/default-configs/mips64-linux-user.mak
+++ b/default-configs/mips64-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for mips64-linux-user
+
+include mips-linux-user-common.mak
diff --git a/default-configs/mips64el-linux-user.mak b/default-configs/mips64el-linux-user.mak
index 629f084086..6399af3fd5 100644
--- a/default-configs/mips64el-linux-user.mak
+++ b/default-configs/mips64el-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for mips64el-linux-user
+
+include mips-linux-user-common.mak
diff --git a/default-configs/mipsel-linux-user.mak b/default-configs/mipsel-linux-user.mak
index 4d0e4afb69..4a27d30b45 100644
--- a/default-configs/mipsel-linux-user.mak
+++ b/default-configs/mipsel-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for mipsel-linux-user
+
+include mips-linux-user-common.mak
diff --git a/default-configs/mipsn32-linux-user.mak b/default-configs/mipsn32-linux-user.mak
index 5b97919794..f3ac967463 100644
--- a/default-configs/mipsn32-linux-user.mak
+++ b/default-configs/mipsn32-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for mipsn32-linux-user
+
+include mips-linux-user-common.mak
diff --git a/default-configs/mipsn32el-linux-user.mak b/default-configs/mipsn32el-linux-user.mak
index d6367ff987..63fe4de4fd 100644
--- a/default-configs/mipsn32el-linux-user.mak
+++ b/default-configs/mipsn32el-linux-user.mak
@@ -1 +1,3 @@
 # Default configuration for mipsn32el-linux-user
+
+include mips-linux-user-common.mak
-- 
2.20.1



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

* [Qemu-devel] [RFC PATCH-for-4.1? v2 3/5] hw/semihosting: Allow this feature to be disabled
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 1/5] target/arm: Always enable CONFIG_SEMIHOSTING Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 2/5] target/mips: " Philippe Mathieu-Daudé
@ 2019-07-15 15:22 ` Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 4/5] target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-15 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, Philippe Mathieu-Daudé,
	qemu-arm, Aleksandar Markovic, Paolo Bonzini, James Hogan,
	Alex Bennée, Aurelien Jarno

So far only the ARM/MIPS/LM32 provide the semihosting feature.

Do not enable it by default, and let the few targets requiring
it to manually select it (Actually only ARM/MIPS).

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/semihosting/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/semihosting/Kconfig b/hw/semihosting/Kconfig
index efe0a30734..61edb4ada8 100644
--- a/hw/semihosting/Kconfig
+++ b/hw/semihosting/Kconfig
@@ -1,3 +1,4 @@
 
 config SEMIHOSTING
-       bool
+    bool
+    default n
-- 
2.20.1



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

* [Qemu-devel] [RFC PATCH-for-4.1? v2 4/5] target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 3/5] hw/semihosting: Allow this feature to be disabled Philippe Mathieu-Daudé
@ 2019-07-15 15:22 ` Philippe Mathieu-Daudé
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 5/5] target/mips: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-15 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, Philippe Mathieu-Daudé,
	qemu-arm, Aleksandar Markovic, Paolo Bonzini, Miroslav Rezanina,
	James Hogan, Alex Bennée, Aurelien Jarno

If a distribution wants to build QEMU without semihosting support,
it currently gets this build failure:

  $ ./configure --target-list=aarch64-softmmu --without-default-devices
  $ sed -i s/CONFIG_SEMIHOSTING=y/CONFIG_SEMIHOSTING=n/ default-configs/arm-softmmu.mak
  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: target/arm/arm-semi.o: in function `do_arm_semihosting':
  ./target/arm/arm-semi.c:321: undefined reference to `qemu_semihosting_console_out'
  /usr/bin/ld: ./target/arm/arm-semi.c:318: undefined reference to `qemu_semihosting_console_out'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:204: qemu-system-aarch64] Error 1
  make: *** [Makefile:472: subdir-aarch64-softmmu] Error 2

Fix it by providing a stub when semihosting is disabled.

Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 default-configs/arm-softmmu.mak |  2 +-
 target/arm/Makefile.objs        |  3 ++-
 target/arm/arm-semi-stubs.c     | 21 +++++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 target/arm/arm-semi-stubs.c

diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index ad2debf543..bf34bcb137 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -1,6 +1,6 @@
 # Default configuration for arm-softmmu
 
-# CONFIG_SEMIHOSTING is always required on this architecture
+# CONFIG_SEMIHOSTING is not required on KVM only builds
 CONFIG_SEMIHOSTING=y
 
 # TODO: ARM_V7M is currently always required - make this more flexible!
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
index 5cafc1eb6c..4afaf82bbe 100644
--- a/target/arm/Makefile.objs
+++ b/target/arm/Makefile.objs
@@ -1,4 +1,5 @@
-obj-$(CONFIG_TCG) += arm-semi.o
+obj-$(CONFIG_SEMIHOSTING) += arm-semi.o
+obj-$(call lnot,$(CONFIG_SEMIHOSTING)) += arm-semi-stubs.o
 obj-y += helper.o vfp_helper.o
 obj-y += cpu.o gdbstub.o
 obj-$(TARGET_AARCH64) += cpu64.o gdbstub64.o
diff --git a/target/arm/arm-semi-stubs.c b/target/arm/arm-semi-stubs.c
new file mode 100644
index 0000000000..a91ecbd9d5
--- /dev/null
+++ b/target/arm/arm-semi-stubs.c
@@ -0,0 +1,21 @@
+/*
+ *  Arm "Angel" semihosting stubs
+ *
+ * Copyright (c) 2019 Red Hat, Inc.
+ *
+ * Author:
+ *   Philippe Mathieu-Daudé <philmd@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+
+target_ulong do_arm_semihosting(CPUARMState *env)
+{
+    g_assert_not_reached();
+}
-- 
2.20.1



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

* [Qemu-devel] [RFC PATCH-for-4.1? v2 5/5] target/mips: Add stubs to build with CONFIG_SEMIHOSTING disabled
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 4/5] target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
@ 2019-07-15 15:22 ` Philippe Mathieu-Daudé
  2019-07-15 21:09 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build " no-reply
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-15 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, Philippe Mathieu-Daudé,
	qemu-arm, Aleksandar Markovic, Paolo Bonzini, James Hogan,
	Alex Bennée, Aurelien Jarno

If a distribution wants to build QEMU without semihosting support,
it currently gets this build failure:

  $ ./configure --target-list=mips64el-softmmu --without-default-devices
  $ sed -i s/CONFIG_SEMIHOSTING=y/CONFIG_SEMIHOSTING=n/ default-configs/mips-softmmu-common.mak
  $ make subdir-mips64el-softmmu
  [...]
    LINK    mips64el-softmmu/qemu-system-mips64el
  /usr/bin/ld: target/mips/mips-semi.o: in function `helper_do_semihosting':
  ./target/mips/mips-semi.c:335: undefined reference to `qemu_semihosting_log_out'
  /usr/bin/ld: ./target/mips/mips-semi.c:338: undefined reference to `qemu_semihosting_log_out'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:204: qemu-system-mips64el] Error 1
  make: *** [Makefile:472: subdir-mips64el-softmmu] Error 2

Fix it by providing a stub when semihosting is disabled.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 default-configs/mips-softmmu-common.mak |  2 +-
 target/mips/Makefile.objs               |  3 ++-
 target/mips/mips-semi-stubs.c           | 22 ++++++++++++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 target/mips/mips-semi-stubs.c

diff --git a/default-configs/mips-softmmu-common.mak b/default-configs/mips-softmmu-common.mak
index da29c6c0b2..08fa16191f 100644
--- a/default-configs/mips-softmmu-common.mak
+++ b/default-configs/mips-softmmu-common.mak
@@ -1,6 +1,6 @@
 # Common mips*-softmmu CONFIG defines
 
-# CONFIG_SEMIHOSTING is always required on this architecture
+# CONFIG_SEMIHOSTING is probably not required on KVM only builds
 CONFIG_SEMIHOSTING=y
 
 CONFIG_ISA_BUS=y
diff --git a/target/mips/Makefile.objs b/target/mips/Makefile.objs
index 3448ad5e19..3f4d566a35 100644
--- a/target/mips/Makefile.objs
+++ b/target/mips/Makefile.objs
@@ -1,5 +1,6 @@
 obj-y += translate.o dsp_helper.o op_helper.o lmi_helper.o helper.o cpu.o
 obj-y += gdbstub.o msa_helper.o
-obj-$(CONFIG_SOFTMMU) += mips-semi.o
+obj-$(CONFIG_SEMIHOSTING) += mips-semi.o
+obj-$(call lnot,$(CONFIG_SEMIHOSTING)) += mips-semi-stubs.o
 obj-$(CONFIG_SOFTMMU) += machine.o cp0_timer.o
 obj-$(CONFIG_KVM) += kvm.o
diff --git a/target/mips/mips-semi-stubs.c b/target/mips/mips-semi-stubs.c
new file mode 100644
index 0000000000..b1d3f88edc
--- /dev/null
+++ b/target/mips/mips-semi-stubs.c
@@ -0,0 +1,22 @@
+/*
+ * Unified Hosting Interface syscalls stubs
+ *
+ * Copyright (c) 2019 Red Hat, Inc.
+ *
+ * Author:
+ *   Philippe Mathieu-Daudé <philmd@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "exec/helper-proto.h"
+
+void helper_do_semihosting(CPUMIPSState *env)
+{
+    g_assert_not_reached();
+}
-- 
2.20.1



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

* Re: [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 5/5] target/mips: " Philippe Mathieu-Daudé
@ 2019-07-15 21:09 ` no-reply
  2019-07-16  9:30 ` Philippe Mathieu-Daudé
  2019-07-16 14:14 ` no-reply
  7 siblings, 0 replies; 9+ messages in thread
From: no-reply @ 2019-07-15 21:09 UTC (permalink / raw)
  To: philmd
  Cc: peter.maydell, thuth, arikalo, jhogan, riku.voipio, qemu-devel,
	laurent, alex.bennee, qemu-arm, amarkovic, pbonzini, james.hogan,
	philmd, aurelien

Patchew URL: https://patchew.org/QEMU/20190715152225.26135-1-philmd@redhat.com/



Hi,

This series failed build test on s390x host. Please find the details below.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
set -e

echo
echo "=== ENV ==="
env

echo
echo "=== PACKAGES ==="
rpm -qa

echo
echo "=== UNAME ==="
uname -a

CC=$HOME/bin/cc
INSTALL=$PWD/install
BUILD=$PWD/build
mkdir -p $BUILD $INSTALL
SRC=$PWD
cd $BUILD
$SRC/configure --cc=$CC --prefix=$INSTALL
make -j4
# XXX: we need reliable clean up
# make check -j4 V=1
make install
=== TEST SCRIPT END ===

  CC      mips64-linux-user/linux-user/fd-trans.o
  CC      mips64-linux-user/target/mips/translate.o
  CC      mips64el-linux-user/target/mips/mips-semi-stubs.o
/var/tmp/patchew-tester-tmp-n0mrs_zw/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
  CC      mipsel-linux-user/target/mips/translate.o
  CC      mips64-linux-user/target/mips/msa_helper.o
  CC      mips64-linux-user/target/mips/mips-semi-stubs.o
/var/tmp/patchew-tester-tmp-n0mrs_zw/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
  CC      mipsel-linux-user/target/mips/mips-semi-stubs.o
  GEN     trace/generated-helpers.c
  CC      mipsel-linux-user/trace/control-target.o
/var/tmp/patchew-tester-tmp-n0mrs_zw/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


The full log is available at
http://patchew.org/logs/20190715152225.26135-1-philmd@redhat.com/testing.s390x/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2019-07-15 21:09 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build " no-reply
@ 2019-07-16  9:30 ` Philippe Mathieu-Daudé
  2019-07-16 14:14 ` no-reply
  7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-16  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Thomas Huth, Aleksandar Rikalo, James Hogan,
	Riku Voipio, Laurent Vivier, qemu-arm, Aleksandar Markovic,
	Paolo Bonzini, James Hogan, Alex Bennée, Aurelien Jarno

On 7/15/19 5:22 PM, Philippe Mathieu-Daudé wrote:
> Amusingly Miroslav and myself hit this issue at the same time.
> 
> Note now that "config-devices.h" exists (commit 6c22ea9d83) I could use
> #include "config-devices.h" to implement Alex's suggestion to avoid a stub:
> https://lists.gnu.org/archive/html/qemu-devel/2019-06/msg03607.html
> 
> Some know (arch-specific) limitations are:
> 
> - MIPS ITU is accessed by coprocessor instr (ISA feature)
> - MIPS timer is accessed by coprocessor instr (ISA feature)
> - MIPS semihosting (ISA feature?)
> - ARM semihosting (ISA feature?)
> - ARMv7 NVIC (device)
> 
> This series attempt to fix this the most trivial way, adding
> stubs for unreachable code.

Please disregard this series for 4.1 release.

As explained Peter on IRC, "feature changes need to be ready before
softfreeze".


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

* Re: [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled
  2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2019-07-16  9:30 ` Philippe Mathieu-Daudé
@ 2019-07-16 14:14 ` no-reply
  7 siblings, 0 replies; 9+ messages in thread
From: no-reply @ 2019-07-16 14:14 UTC (permalink / raw)
  To: philmd
  Cc: peter.maydell, thuth, arikalo, jhogan, riku.voipio, qemu-devel,
	laurent, alex.bennee, qemu-arm, amarkovic, pbonzini, james.hogan,
	philmd, aurelien

Patchew URL: https://patchew.org/QEMU/20190715152225.26135-1-philmd@redhat.com/



Hi,

This series failed build test on s390x host. Please find the details below.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
set -e

echo
echo "=== ENV ==="
env

echo
echo "=== PACKAGES ==="
rpm -qa

echo
echo "=== UNAME ==="
uname -a

CC=$HOME/bin/cc
INSTALL=$PWD/install
BUILD=$PWD/build
mkdir -p $BUILD $INSTALL
SRC=$PWD
cd $BUILD
$SRC/configure --cc=$CC --prefix=$INSTALL
make -j4
# XXX: we need reliable clean up
# make check -j4 V=1
make install
=== TEST SCRIPT END ===

  CC      mips-linux-user/target/mips/gdbstub.o
  CC      mips-linux-user/target/mips/msa_helper.o
  CC      mipsel-linux-user/target/mips/mips-semi-stubs.o
/var/tmp/patchew-tester-tmp-3dkdm5ft/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
  CC      mips64-linux-user/fpu/softfloat.o
  CC      mips-linux-user/target/mips/mips-semi-stubs.o
  CC      mips64-linux-user/gdbstub.o
/var/tmp/patchew-tester-tmp-3dkdm5ft/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
  CC      mips64-linux-user/accel/tcg/tcg-runtime-gvec.o
  CC      mips64el-linux-user/target/mips/mips-semi-stubs.o
  CC      mips64-linux-user/accel/tcg/cpu-exec.o
/var/tmp/patchew-tester-tmp-3dkdm5ft/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
  CC      mips64-linux-user/target/mips/gdbstub.o
  CC      mips64-linux-user/target/mips/msa_helper.o
  CC      mips64-linux-user/target/mips/mips-semi-stubs.o
/var/tmp/patchew-tester-tmp-3dkdm5ft/src/target/mips/mips-semi-stubs.c:19:6: error: no previous prototype for ‘helper_do_semihosting’ [-Werror=missing-prototypes]
   19 | void helper_do_semihosting(CPUMIPSState *env)
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


The full log is available at
http://patchew.org/logs/20190715152225.26135-1-philmd@redhat.com/testing.s390x/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

end of thread, other threads:[~2019-07-16 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 15:22 [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 1/5] target/arm: Always enable CONFIG_SEMIHOSTING Philippe Mathieu-Daudé
2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 2/5] target/mips: " Philippe Mathieu-Daudé
2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 3/5] hw/semihosting: Allow this feature to be disabled Philippe Mathieu-Daudé
2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 4/5] target/arm: Add stubs to build with CONFIG_SEMIHOSTING disabled Philippe Mathieu-Daudé
2019-07-15 15:22 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 5/5] target/mips: " Philippe Mathieu-Daudé
2019-07-15 21:09 ` [Qemu-devel] [RFC PATCH-for-4.1? v2 0/5] semihosting: Build " no-reply
2019-07-16  9:30 ` Philippe Mathieu-Daudé
2019-07-16 14:14 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).