[PATCH v4 2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss

Richard Henderson posted 3 patches 3 years, 8 months ago
Maintainers: Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>
There is a newer version of this series
[PATCH v4 2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss
Posted by Richard Henderson 3 years, 8 months ago
Semihosting is not enabled for nios2-linux-user.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/nios2/nios2-semi.c | 5 -----
 target/nios2/meson.build  | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
index bdf8849689..55061bb2dc 100644
--- a/target/nios2/nios2-semi.c
+++ b/target/nios2/nios2-semi.c
@@ -22,14 +22,9 @@
  */
 
 #include "qemu/osdep.h"
-
 #include "cpu.h"
 #include "exec/gdbstub.h"
-#if defined(CONFIG_USER_ONLY)
-#include "qemu.h"
-#else
 #include "semihosting/softmmu-uaccess.h"
-#endif
 #include "qemu/log.h"
 
 #define HOSTED_EXIT  0
diff --git a/target/nios2/meson.build b/target/nios2/meson.build
index 2bd60ba306..c6e2243cc3 100644
--- a/target/nios2/meson.build
+++ b/target/nios2/meson.build
@@ -1,7 +1,6 @@
 nios2_ss = ss.source_set()
 nios2_ss.add(files(
   'cpu.c',
-  'nios2-semi.c',
   'op_helper.c',
   'translate.c',
 ))
@@ -10,7 +9,8 @@ nios2_softmmu_ss = ss.source_set()
 nios2_softmmu_ss.add(files(
   'helper.c',
   'monitor.c',
-  'mmu.c'
+  'mmu.c',
+  'nios2-semi.c',
 ))
 
 target_arch += {'nios2': nios2_ss}
-- 
2.34.1
Re: [PATCH v4 2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss
Posted by Philippe Mathieu-Daudé via 3 years, 8 months ago
On 8/6/22 04:38, Richard Henderson wrote:
> Semihosting is not enabled for nios2-linux-user.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/nios2/nios2-semi.c | 5 -----
>   target/nios2/meson.build  | 4 ++--
>   2 files changed, 2 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


Re: [PATCH v4 2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss
Posted by Peter Maydell 3 years, 8 months ago
On Wed, 8 Jun 2022 at 03:43, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Semihosting is not enabled for nios2-linux-user.

True, but maybe it ought to be (in an ideal world)?

Anyway, as far as this patch goes
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

If we ever add semihosting support to linux-user nios2 it's
easy enough to undo this.

thanks
-- PMM
Re: [PATCH v4 2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss
Posted by Richard Henderson 3 years, 7 months ago
On 6/9/22 03:36, Peter Maydell wrote:
> On Wed, 8 Jun 2022 at 03:43, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Semihosting is not enabled for nios2-linux-user.
> 
> True, but maybe it ought to be (in an ideal world)?

No, I think ideally there'd be no semihosting for user-only.
If you can write to semihosting, you can write to regular syscalls.

Semihosting is good for when we want to do testing of system-mode stuff, and we don't want 
the complication of a full os getting in the way.


r~
Re: [PATCH v4 2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss
Posted by Peter Maydell 3 years, 7 months ago
On Mon, 20 Jun 2022 at 23:04, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 6/9/22 03:36, Peter Maydell wrote:
> > On Wed, 8 Jun 2022 at 03:43, Richard Henderson
> > <richard.henderson@linaro.org> wrote:
> >>
> >> Semihosting is not enabled for nios2-linux-user.
> >
> > True, but maybe it ought to be (in an ideal world)?
>
> No, I think ideally there'd be no semihosting for user-only.
> If you can write to semihosting, you can write to regular syscalls.

You can, but there are also use cases (notably the gcc test suite)
where people want to run semihosting binaries under usermode.
We can't take away usermode semihosting for those targets where
people are actively using it, so I think it would be more consistent
to support it for usermode for all architectures rather than just
some.

-- PMM