diff mbox series

[1/4] semihosting: Move ARM semihosting code to shared directories [v3]

Message ID 20201028185722.2783532-2-keithp@keithp.com
State New
Headers show
Series Add RISC-V semihosting support | expand

Commit Message

Xingtao Yao (Fujitsu)" via Oct. 28, 2020, 6:57 p.m. UTC
This commit renames two files which provide ARM semihosting support so
that they can be shared by other architectures:

 1. target/arm/arm-semi.c     -> hw/semihosting/common-semi.c
 2. linux-user/arm/semihost.c -> linux-user/semihost.c

The build system was modified use a new config variable,
CONFIG_ARM_COMPATIBLE_SEMIHOSTING, which has been added to the ARM
softmmu and linux-user default configs. The contents of the source
files has not been changed in this patch.

Signed-off-by: Keith Packard <keithp@keithp.com>

----

v2
	Place common-semi.c name in arm_ss, just as arm-semi.c was

v3
	Create CONFIG_ARM_COMPATIBLE_SEMIHOSTING and assign in
	arm config files
---
 default-configs/devices/arm-softmmu.mak               | 1 +
 default-configs/targets/aarch64-linux-user.mak        | 1 +
 default-configs/targets/arm-linux-user.mak            | 1 +
 hw/semihosting/Kconfig                                | 3 +++
 target/arm/arm-semi.c => hw/semihosting/common-semi.c | 0
 hw/semihosting/meson.build                            | 3 +++
 linux-user/arm/meson.build                            | 3 ---
 linux-user/meson.build                                | 1 +
 linux-user/{arm => }/semihost.c                       | 0
 target/arm/meson.build                                | 2 --
 10 files changed, 10 insertions(+), 5 deletions(-)
 rename target/arm/arm-semi.c => hw/semihosting/common-semi.c (100%)
 rename linux-user/{arm => }/semihost.c (100%)

Comments

Alistair Francis Nov. 9, 2020, 11:17 p.m. UTC | #1
On Wed, Oct 28, 2020 at 11:57 AM Keith Packard via
<qemu-devel@nongnu.org> wrote:
>

> This commit renames two files which provide ARM semihosting support so

> that they can be shared by other architectures:

>

>  1. target/arm/arm-semi.c     -> hw/semihosting/common-semi.c

>  2. linux-user/arm/semihost.c -> linux-user/semihost.c

>

> The build system was modified use a new config variable,

> CONFIG_ARM_COMPATIBLE_SEMIHOSTING, which has been added to the ARM

> softmmu and linux-user default configs. The contents of the source

> files has not been changed in this patch.

>

> Signed-off-by: Keith Packard <keithp@keithp.com>


Reviewed-by: Alistair Francis <alistair.francis@wdc.com>


Alistair

>

> ----

>

> v2

>         Place common-semi.c name in arm_ss, just as arm-semi.c was

>

> v3

>         Create CONFIG_ARM_COMPATIBLE_SEMIHOSTING and assign in

>         arm config files

> ---

>  default-configs/devices/arm-softmmu.mak               | 1 +

>  default-configs/targets/aarch64-linux-user.mak        | 1 +

>  default-configs/targets/arm-linux-user.mak            | 1 +

>  hw/semihosting/Kconfig                                | 3 +++

>  target/arm/arm-semi.c => hw/semihosting/common-semi.c | 0

>  hw/semihosting/meson.build                            | 3 +++

>  linux-user/arm/meson.build                            | 3 ---

>  linux-user/meson.build                                | 1 +

>  linux-user/{arm => }/semihost.c                       | 0

>  target/arm/meson.build                                | 2 --

>  10 files changed, 10 insertions(+), 5 deletions(-)

>  rename target/arm/arm-semi.c => hw/semihosting/common-semi.c (100%)

>  rename linux-user/{arm => }/semihost.c (100%)

>

> diff --git a/default-configs/devices/arm-softmmu.mak b/default-configs/devices/arm-softmmu.mak

> index 08a32123b4..0500156a0c 100644

> --- a/default-configs/devices/arm-softmmu.mak

> +++ b/default-configs/devices/arm-softmmu.mak

> @@ -42,4 +42,5 @@ CONFIG_FSL_IMX25=y

>  CONFIG_FSL_IMX7=y

>  CONFIG_FSL_IMX6UL=y

>  CONFIG_SEMIHOSTING=y

> +CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y

>  CONFIG_ALLWINNER_H3=y

> diff --git a/default-configs/targets/aarch64-linux-user.mak b/default-configs/targets/aarch64-linux-user.mak

> index 163c9209f4..4713253709 100644

> --- a/default-configs/targets/aarch64-linux-user.mak

> +++ b/default-configs/targets/aarch64-linux-user.mak

> @@ -2,3 +2,4 @@ TARGET_ARCH=aarch64

>  TARGET_BASE_ARCH=arm

>  TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml

>  TARGET_HAS_BFLT=y

> +CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y

> diff --git a/default-configs/targets/arm-linux-user.mak b/default-configs/targets/arm-linux-user.mak

> index c7cd872e86..e741ffd4d3 100644

> --- a/default-configs/targets/arm-linux-user.mak

> +++ b/default-configs/targets/arm-linux-user.mak

> @@ -3,3 +3,4 @@ TARGET_SYSTBL_ABI=common,oabi

>  TARGET_SYSTBL=syscall.tbl

>  TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml

>  TARGET_HAS_BFLT=y

> +CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y

> diff --git a/hw/semihosting/Kconfig b/hw/semihosting/Kconfig

> index efe0a30734..4c30dc6b16 100644

> --- a/hw/semihosting/Kconfig

> +++ b/hw/semihosting/Kconfig

> @@ -1,3 +1,6 @@

>

>  config SEMIHOSTING

>         bool

> +

> +config ARM_COMPATIBLE_SEMIHOSTING

> +       bool

> diff --git a/target/arm/arm-semi.c b/hw/semihosting/common-semi.c

> similarity index 100%

> rename from target/arm/arm-semi.c

> rename to hw/semihosting/common-semi.c

> diff --git a/hw/semihosting/meson.build b/hw/semihosting/meson.build

> index f40ac574c4..5b4a170270 100644

> --- a/hw/semihosting/meson.build

> +++ b/hw/semihosting/meson.build

> @@ -2,3 +2,6 @@ specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(

>    'config.c',

>    'console.c',

>  ))

> +

> +specific_ss.add(when: ['CONFIG_ARM_COMPATIBLE_SEMIHOSTING'],

> +               if_true: files('common-semi.c'))

> diff --git a/linux-user/arm/meson.build b/linux-user/arm/meson.build

> index 432984b58e..5a93c925cf 100644

> --- a/linux-user/arm/meson.build

> +++ b/linux-user/arm/meson.build

> @@ -1,6 +1,3 @@

> -linux_user_ss.add(when: 'TARGET_AARCH64', if_true: files('semihost.c'))

> -linux_user_ss.add(when: 'TARGET_ARM', if_true: files('semihost.c'))

> -

>  subdir('nwfpe')

>

>  syscall_nr_generators += {

> diff --git a/linux-user/meson.build b/linux-user/meson.build

> index 2b94e4ba24..7fe28d659e 100644

> --- a/linux-user/meson.build

> +++ b/linux-user/meson.build

> @@ -16,6 +16,7 @@ linux_user_ss.add(rt)

>

>  linux_user_ss.add(when: 'TARGET_HAS_BFLT', if_true: files('flatload.c'))

>  linux_user_ss.add(when: 'TARGET_I386', if_true: files('vm86.c'))

> +linux_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', if_true: files('semihost.c'))

>

>

>  syscall_nr_generators = {}

> diff --git a/linux-user/arm/semihost.c b/linux-user/semihost.c

> similarity index 100%

> rename from linux-user/arm/semihost.c

> rename to linux-user/semihost.c

> diff --git a/target/arm/meson.build b/target/arm/meson.build

> index f5de2a77b8..15b936c101 100644

> --- a/target/arm/meson.build

> +++ b/target/arm/meson.build

> @@ -32,8 +32,6 @@ arm_ss.add(files(

>  ))

>  arm_ss.add(zlib)

>

> -arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))

> -

>  arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))

>

>  arm_ss.add(when: 'TARGET_AARCH64', if_true: files(

> --

> 2.28.0

>

>
Xingtao Yao (Fujitsu)" via Nov. 10, 2020, 5:25 a.m. UTC | #2
Alistair Francis <alistair23@gmail.com> writes:

> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>


Thanks much. I think we'll need some help getting the next two patches
reviewed; that touches ARM code. The last patch is also RISC-V only.

-- 
-keith
diff mbox series

Patch

diff --git a/default-configs/devices/arm-softmmu.mak b/default-configs/devices/arm-softmmu.mak
index 08a32123b4..0500156a0c 100644
--- a/default-configs/devices/arm-softmmu.mak
+++ b/default-configs/devices/arm-softmmu.mak
@@ -42,4 +42,5 @@  CONFIG_FSL_IMX25=y
 CONFIG_FSL_IMX7=y
 CONFIG_FSL_IMX6UL=y
 CONFIG_SEMIHOSTING=y
+CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
 CONFIG_ALLWINNER_H3=y
diff --git a/default-configs/targets/aarch64-linux-user.mak b/default-configs/targets/aarch64-linux-user.mak
index 163c9209f4..4713253709 100644
--- a/default-configs/targets/aarch64-linux-user.mak
+++ b/default-configs/targets/aarch64-linux-user.mak
@@ -2,3 +2,4 @@  TARGET_ARCH=aarch64
 TARGET_BASE_ARCH=arm
 TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml
 TARGET_HAS_BFLT=y
+CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
diff --git a/default-configs/targets/arm-linux-user.mak b/default-configs/targets/arm-linux-user.mak
index c7cd872e86..e741ffd4d3 100644
--- a/default-configs/targets/arm-linux-user.mak
+++ b/default-configs/targets/arm-linux-user.mak
@@ -3,3 +3,4 @@  TARGET_SYSTBL_ABI=common,oabi
 TARGET_SYSTBL=syscall.tbl
 TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml
 TARGET_HAS_BFLT=y
+CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
diff --git a/hw/semihosting/Kconfig b/hw/semihosting/Kconfig
index efe0a30734..4c30dc6b16 100644
--- a/hw/semihosting/Kconfig
+++ b/hw/semihosting/Kconfig
@@ -1,3 +1,6 @@ 
 
 config SEMIHOSTING
        bool
+
+config ARM_COMPATIBLE_SEMIHOSTING
+       bool
diff --git a/target/arm/arm-semi.c b/hw/semihosting/common-semi.c
similarity index 100%
rename from target/arm/arm-semi.c
rename to hw/semihosting/common-semi.c
diff --git a/hw/semihosting/meson.build b/hw/semihosting/meson.build
index f40ac574c4..5b4a170270 100644
--- a/hw/semihosting/meson.build
+++ b/hw/semihosting/meson.build
@@ -2,3 +2,6 @@  specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
   'config.c',
   'console.c',
 ))
+
+specific_ss.add(when: ['CONFIG_ARM_COMPATIBLE_SEMIHOSTING'],
+		if_true: files('common-semi.c'))
diff --git a/linux-user/arm/meson.build b/linux-user/arm/meson.build
index 432984b58e..5a93c925cf 100644
--- a/linux-user/arm/meson.build
+++ b/linux-user/arm/meson.build
@@ -1,6 +1,3 @@ 
-linux_user_ss.add(when: 'TARGET_AARCH64', if_true: files('semihost.c'))
-linux_user_ss.add(when: 'TARGET_ARM', if_true: files('semihost.c'))
-
 subdir('nwfpe')
 
 syscall_nr_generators += {
diff --git a/linux-user/meson.build b/linux-user/meson.build
index 2b94e4ba24..7fe28d659e 100644
--- a/linux-user/meson.build
+++ b/linux-user/meson.build
@@ -16,6 +16,7 @@  linux_user_ss.add(rt)
 
 linux_user_ss.add(when: 'TARGET_HAS_BFLT', if_true: files('flatload.c'))
 linux_user_ss.add(when: 'TARGET_I386', if_true: files('vm86.c'))
+linux_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', if_true: files('semihost.c'))
 
 
 syscall_nr_generators = {}
diff --git a/linux-user/arm/semihost.c b/linux-user/semihost.c
similarity index 100%
rename from linux-user/arm/semihost.c
rename to linux-user/semihost.c
diff --git a/target/arm/meson.build b/target/arm/meson.build
index f5de2a77b8..15b936c101 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -32,8 +32,6 @@  arm_ss.add(files(
 ))
 arm_ss.add(zlib)
 
-arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))
-
 arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))
 
 arm_ss.add(when: 'TARGET_AARCH64', if_true: files(