Skip to contentSkip to conversation

accel: Allow targets to use Kconfig, disable semihosting by default

PATCH Superseded Philippe Mathieu-Daudé 7 participants 34 messages Mar 16, 2020 – Apr 23, 2020 5 messages not in the archive Kbuild

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover accel: Allow targets to use Kconfig, disable semihosting by default

This series include generic patches I took of the KVM/ARM specific series which will follow.

- List orphan accelerators in MAINTAINERS
- Add accel/Kconfig
- Allow targets to use their how Kconfig
- Enforce semihosting on ARM/LM32/MIPS, disable it elsewhere

Previous RFC for semihosting posted earlier:
https://www.mail-archive.com/[email protected]/msg631218.html

Philippe Mathieu-Daudé (11):
MAINTAINERS: Fix KVM path expansion glob
MAINTAINERS: Add an 'overall' entry for accelerators
MAINTAINERS: Add an entry for the HAX accelerator
MAINTAINERS: Add an entry for the HVF accelerator
Makefile: Write MINIKCONF variables as one entry per line accel/Kconfig: Extract accel selectors into their own config accel/Kconfig: Add the TCG selector
target/Kconfig: Allow targets to use Kconfig
target/mips: Always enable CONFIG_SEMIHOSTING
target/arm: Always enable CONFIG_SEMIHOSTING hw/semihosting: Make the feature depend of TCG, and allow to disable
it

 Makefile                                      | 10 ++++++--
 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/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 ++
 Kconfig.host                                  |  7 ------
 MAINTAINERS                                   | 23 ++++++++++++++++++-
 accel/Kconfig                                 |  9 ++++++++
 hw/semihosting/Kconfig                        |  4 +++-
 target/Kconfig                                |  1 +
 20 files changed, 78 insertions(+), 12 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 accel/Kconfig
 create mode 100644 target/Kconfig
Signature · 1 line
2.21.1
#1 lore raw

PATCH 1/11 MAINTAINERS: Fix KVM path expansion glob

The KVM files has been moved from target-ARCH to the target/ARCH/ folder in commit fcf5ef2a. Fix the pathname expansion.

Fixes fcf5ef2a ("Move target-* CPU file into a target/ folder")
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index 32867bc636..7898e338f6 100644
@@ -353,7 +353,7 @@ Overall KVM CPUs
 M: Paolo Bonzini <[email protected]>
 L: [email protected]
 S: Supported
-F: */kvm.*
+F: */*/kvm*
 F: accel/kvm/
 F: accel/stubs/kvm-stub.c
 F: include/hw/kvm/
Signature · 1 line
2.21.1
Reviewed-by on v1 1/11
#2 lore raw

Re: [PATCH 01/11] MAINTAINERS: Fix KVM path expansion glob

Quoted 8 lines · Philippe Mathieu-Daudé

The KVM files has been moved from target-ARCH to the target/ARCH/ folder in commit fcf5ef2a. Fix the pathname expansion.

Fixes fcf5ef2a ("Move target-* CPU file into a target/ folder")
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

r~

#3 lore raw

Re: [PATCH 01/11] MAINTAINERS: Fix KVM path expansion glob

Quoted 4 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé

The KVM files has been moved from target-ARCH to the target/ARCH/ folder in commit fcf5ef2a. Fix the pathname expansion.

Quoted 8 lines
Quoted 5 lines
Fixes fcf5ef2a ("Move target-* CPU file into a target/ folder")
---
  MAINTAINERS | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Paolo, do you plan to queue this trivial patch or should I ask qemu-trivial?

#5 lore raw

PATCH 2/11 MAINTAINERS: Add an 'overall' entry for accelerators

In reply to Philippe Mathieu-Daudé

---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index 7898e338f6..08d9556ab2 100644
@@ -405,6 +405,15 @@ S: Supported
 F: target/i386/kvm.c
 F: scripts/kvm/vmxcap
 
+Guest CPU Cores (other accelerators)
+------------------------------------
+Overall
+M: Richard Henderson <[email protected]>
+R: Paolo Bonzini <[email protected]>
+S: Maintained
+F: include/sysemu/accel.h
+F: accel/stubs/Makefile.objs
+
 WHPX CPUs
 M: Sunil Muthuswamy <[email protected]>
 S: Supported
Signature · 1 line
2.21.1
#7 lore raw

PATCH 3/11 MAINTAINERS: Add an entry for the HAX accelerator

In reply to Philippe Mathieu-Daudé

---
Cc: Sergio Andres Gomez Del Real <[email protected]>
Cc: Vincent Palatin <[email protected]>
Cc: Yu Ning <[email protected]>
Cc: Tao Wu <[email protected]>
Cc: [email protected]
Cc: Colin Xu <[email protected]>
Cc: Hang Yuan <[email protected]>
Cc: David Chou <[email protected]>
Cc: Wenchao Wang <[email protected]>

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 08d9556ab2..7ec42a18f7 100644
@@ -414,6 +414,12 @@ S: Maintained
 F: include/sysemu/accel.h
 F: accel/stubs/Makefile.objs
 
+HAX Accelerator
+S: Orphan
+F: accel/stubs/hax-stub.c
+F: target/i386/hax-all.c
+F: include/sysemu/hax.h
+
 WHPX CPUs
 M: Sunil Muthuswamy <[email protected]>
 S: Supported
Signature · 1 line
2.21.1
#8 lore raw

PATCH 4/11 MAINTAINERS: Add an entry for the HVF accelerator

In reply to Philippe Mathieu-Daudé

---
Cc: Reviewed-by: Nikita Leshenko <[email protected]>
Cc: Sergio Andres Gomez Del Real <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Patrick Colp <[email protected]>
Cc: Cameron Esfahani <[email protected]>
Cc: Liran Alon <[email protected]>
Cc: Heiher <[email protected]>

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 7ec42a18f7..bcf40afb85 100644
@@ -420,6 +420,12 @@ F: accel/stubs/hax-stub.c
 F: target/i386/hax-all.c
 F: include/sysemu/hax.h
 
+HVF Accelerator
+S: Orphan
+F: accel/stubs/hvf-stub.c
+F: target/i386/hvf/hvf.c
+F: include/sysemu/hvf.h
+
 WHPX CPUs
 M: Sunil Muthuswamy <[email protected]>
 S: Supported
Signature · 1 line
2.21.1
#9 lore raw

Re: [PATCH 04/11] MAINTAINERS: Add an entry for the HVF accelerator

Hi Philippe,

I can take the ownership if nobody wants it. At the moment I'm working on APIC for HVF to get kvm-unit-tests fixed.

Next items on the list (in no particular order):
* MMX emulation
* SSE emulation
* qxl display
* gdb stub
* virtio-gpu/virgil running on metal
* VFIO-PCI based on macOS user-space DriverKit framework

Best regards,
Roman

Quoted 33 lines · Philippe Mathieu-Daudé

---
Cc: Reviewed-by: Nikita Leshenko <[email protected]>
Cc: Sergio Andres Gomez Del Real <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Patrick Colp <[email protected]>
Cc: Cameron Esfahani <[email protected]>
Cc: Liran Alon <[email protected]>
Cc: Heiher <[email protected]>

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 7ec42a18f7..bcf40afb85 100644
@@ -420,6 +420,12 @@ F: accel/stubs/hax-stub.c
 F: target/i386/hax-all.c
 F: include/sysemu/hax.h
 
+HVF Accelerator
+S: Orphan
+F: accel/stubs/hvf-stub.c
+F: target/i386/hvf/hvf.c
+F: include/sysemu/hvf.h
+
 WHPX CPUs
 M: Sunil Muthuswamy <[email protected]>
 S: Supported
Signature · 1 line
2.21.1
#10 lore raw

Re: [PATCH 04/11] MAINTAINERS: Add an entry for the HVF accelerator

Hi Roman,

Quoted 5 lines · Roman Bolshakov

Hi Philippe,

I can take the ownership if nobody wants it. At the moment I'm working on APIC for HVF to get kvm-unit-tests fixed.

Quoted 7 lines

Next items on the list (in no particular order):
* MMX emulation
* SSE emulation
* qxl display
* gdb stub
* virtio-gpu/virgil running on metal
* VFIO-PCI based on macOS user-space DriverKit framework

Glad to hear :)
I suppose Paolo will be happy to have someone caring about HVF. Do you mind sending a patch to step in?

Thanks,

Phil.

Quoted 39 lines

Best regards,
Roman

Quoted 33 lines · Philippe Mathieu-Daudé

---
Cc: Reviewed-by: Nikita Leshenko <[email protected]>
Cc: Sergio Andres Gomez Del Real <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Patrick Colp <[email protected]>
Cc: Cameron Esfahani <[email protected]>
Cc: Liran Alon <[email protected]>
Cc: Heiher <[email protected]>

---
  MAINTAINERS | 6 ++++++
  1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 7ec42a18f7..bcf40afb85 100644
@@ -420,6 +420,12 @@ F: accel/stubs/hax-stub.c
  F: target/i386/hax-all.c
  F: include/sysemu/hax.h
 
+HVF Accelerator
+S: Orphan
+F: accel/stubs/hvf-stub.c
+F: target/i386/hvf/hvf.c
+F: include/sysemu/hvf.h
+
  WHPX CPUs
  M: Sunil Muthuswamy <[email protected]>
  S: Supported
Signature · 1 line
2.21.1
#11 lore raw

Re: [PATCH 04/11] MAINTAINERS: Add an entry for the HVF accelerator

In reply to Roman Bolshakov

Sorry I didn't see this yesterday.

We've (Apple) signed up for taking over HVF ownership. I didn't realize I needed to add to the MAINTAINERS list.

Roman, we also have a bunch of pending fixes for some of the issues you've listed. We're in the process of upstreaming them.

Cameron Esfahani
[email protected]

"All that is necessary for the triumph of evil is that good men do nothing."

Edmund Burke

Quoted 53 lines · Roman Bolshakov

Hi Philippe,

I can take the ownership if nobody wants it. At the moment I'm working on APIC for HVF to get kvm-unit-tests fixed.

Next items on the list (in no particular order):
* MMX emulation
* SSE emulation
* qxl display
* gdb stub
* virtio-gpu/virgil running on metal
* VFIO-PCI based on macOS user-space DriverKit framework

Best regards,
Roman

Quoted 33 lines · Philippe Mathieu-Daudé

---
Cc: Reviewed-by: Nikita Leshenko <[email protected]>
Cc: Sergio Andres Gomez Del Real <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Patrick Colp <[email protected]>
Cc: Cameron Esfahani <[email protected]>
Cc: Liran Alon <[email protected]>
Cc: Heiher <[email protected]>
---
MAINTAINERS | 6 ++++++

1 file changed, 6 insertions(+)
MAINTAINERS +0 -0
index 7ec42a18f7..bcf40afb85 100644
@@ -420,6 +420,12 @@ F: accel/stubs/hax-stub.c

F: target/i386/hax-all.c
F: include/sysemu/hax.h

MAINTAINERS +6 -0
+HVF Accelerator
+S: Orphan
+F: accel/stubs/hvf-stub.c
+F: target/i386/hvf/hvf.c
+F: include/sysemu/hvf.h
+

WHPX CPUs
M: Sunil Muthuswamy <[email protected]>
S: Supported

Signature · 1 line
2.21.1
#12 lore raw

Re: [PATCH 04/11] MAINTAINERS: Add an entry for the HVF accelerator

Quoted 6 lines · Cameron Esfahani

Sorry I didn't see this yesterday.

We've (Apple) signed up for taking over HVF ownership. I didn't realize I needed to add to the MAINTAINERS list.

Roman, we also have a bunch of pending fixes for some of the issues you've listed. We're in the process of upstreaming them.

Hi Cameron,

That's great news. What exactly are you planning to upstream first? BTW many thanks for the fixes you made last December.

Best regards,
Roman

#13 lore raw

Re: [PATCH 04/11] MAINTAINERS: Add an entry for the HVF accelerator

In reply to Philippe Mathieu-Daudé

Please add me to the HVF maintainers as well.

Cameron Esfahani
[email protected]

"In the elder days of Art, Builders wrought with greatest care each minute and unseen part; For the gods see everywhere."

"The Builders", H. W. Longfellow

Quoted 36 lines · Philippe Mathieu-Daudé

---
Cc: Reviewed-by: Nikita Leshenko <[email protected]>
Cc: Sergio Andres Gomez Del Real <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Cc: Patrick Colp <[email protected]>
Cc: Cameron Esfahani <[email protected]>
Cc: Liran Alon <[email protected]>
Cc: Heiher <[email protected]>
---
MAINTAINERS | 6 ++++++

1 file changed, 6 insertions(+)
MAINTAINERS +0 -0
index 7ec42a18f7..bcf40afb85 100644
@@ -420,6 +420,12 @@ F: accel/stubs/hax-stub.c

F: target/i386/hax-all.c
F: include/sysemu/hax.h

MAINTAINERS +6 -0
+HVF Accelerator
+S: Orphan
+F: accel/stubs/hvf-stub.c
+F: target/i386/hvf/hvf.c
+F: include/sysemu/hvf.h
+

WHPX CPUs
M: Sunil Muthuswamy <[email protected]>
S: Supported

Signature · 1 line
2.21.1
#14 lore raw

PATCH 5/11 Makefile: Write MINIKCONF variables as one entry per line

In reply to Philippe Mathieu-Daudé

Having one entry per line helps reviews/refactors. As we are going to modify the MINIKCONF variables, split them now to ease further review.

---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Makefile +4 -2
index 7df22fcc5d..d83a94bc53 100644
@@ -418,8 +418,10 @@ MINIKCONF_ARGS = \
     CONFIG_LINUX=$(CONFIG_LINUX) \
     CONFIG_PVRDMA=$(CONFIG_PVRDMA)
 
-MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig
-MINIKCONF_DEPS = $(MINIKCONF_INPUTS) $(wildcard $(SRC_PATH)/hw/*/Kconfig)
+MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host \
+                   $(SRC_PATH)/hw/Kconfig
+MINIKCONF_DEPS = $(MINIKCONF_INPUTS) \
+                 $(wildcard $(SRC_PATH)/hw/*/Kconfig)
 MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
 
 $(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIKCONF_DEPS) $(BUILD_DIR)/config-host.mak
Signature · 1 line
2.21.1
Reviewed-by on v1 5/11
#15 lore raw

Re: [PATCH 05/11] Makefile: Write MINIKCONF variables as one entry per line

Quoted 8 lines · Philippe Mathieu-Daudé

Having one entry per line helps reviews/refactors. As we are going to modify the MINIKCONF variables, split them now to ease further review.

---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

r~

#16 lore raw

PATCH 6/11 accel/Kconfig: Extract accel selectors into their own config

In reply to Philippe Mathieu-Daudé

Move the accel selectors from the global Kconfig.host to their own Kconfig file.

---
 Makefile      | 1 +
 Kconfig.host  | 7 -------
 accel/Kconfig | 6 ++++++
 3 files changed, 7 insertions(+), 7 deletions(-)
 create mode 100644 accel/Kconfig
Makefile +1 -0
index d83a94bc53..d1e2ec10e7 100644
@@ -419,6 +419,7 @@ MINIKCONF_ARGS = \
     CONFIG_PVRDMA=$(CONFIG_PVRDMA)
 
 MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host \
+                   $(SRC_PATH)/accel/Kconfig \
                    $(SRC_PATH)/hw/Kconfig
 MINIKCONF_DEPS = $(MINIKCONF_INPUTS) \
                  $(wildcard $(SRC_PATH)/hw/*/Kconfig)
Kconfig.host +0 -7
index 55136e037d..a6d871c399 100644
@@ -2,9 +2,6 @@
 # down to Kconfig.  See also MINIKCONF_ARGS in the Makefile:
 # these two need to be kept in sync.
 
-config KVM
-    bool
-
 config LINUX
     bool
 
@@ -31,10 +28,6 @@ config VHOST_KERNEL
     bool
     select VHOST
 
-config XEN
-    bool
-    select FSDEV_9P if VIRTFS
-
 config VIRTFS
     bool
 
accel/Kconfig new file +6 -0
new file mode 100644
index 0000000000..c21802bb49
@@ -0,0 +1,6 @@
+config KVM
+    bool
+
+config XEN
+    bool
+    select FSDEV_9P if VIRTFS
Signature · 1 line
2.21.1
Reviewed-by on v1 6/11
#17 lore raw

Re: [PATCH 06/11] accel/Kconfig: Extract accel selectors into their own config

Quoted 10 lines · Philippe Mathieu-Daudé

Move the accel selectors from the global Kconfig.host to their own Kconfig file.

---
 Makefile      | 1 +
 Kconfig.host  | 7 -------
 accel/Kconfig | 6 ++++++
 3 files changed, 7 insertions(+), 7 deletions(-)
 create mode 100644 accel/Kconfig

r~

#18 lore raw

PATCH 7/11 accel/Kconfig: Add the TCG selector

In reply to Philippe Mathieu-Daudé

Expose the CONFIG_TCG selector to let minikconf.py uses it.

When building with --disable-tcg build, this helps to deselect devices that are TCG-dependent.

---
 Makefile      | 1 +
 accel/Kconfig | 3 +++
 2 files changed, 4 insertions(+)
Makefile +1 -0
index d1e2ec10e7..1cf9d76ce7 100644
@@ -405,6 +405,7 @@ endif
 MINIKCONF_ARGS = \
     $(CONFIG_MINIKCONF_MODE) \
     $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \
+    CONFIG_TCG=$(CONFIG_TCG) \
     CONFIG_KVM=$(CONFIG_KVM) \
     CONFIG_SPICE=$(CONFIG_SPICE) \
     CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
accel/Kconfig +3 -0
index c21802bb49..2ad94a3839 100644
@@ -1,3 +1,6 @@
+config TCG
+    bool
+
 config KVM
     bool
 
Signature · 1 line
2.21.1
Reviewed-by on v1 7/11
#19 lore raw

Re: [PATCH 07/11] accel/Kconfig: Add the TCG selector

Quoted 10 lines · Philippe Mathieu-Daudé

Expose the CONFIG_TCG selector to let minikconf.py uses it.

When building with --disable-tcg build, this helps to deselect devices that are TCG-dependent.

---
 Makefile      | 1 +
 accel/Kconfig | 3 +++
 2 files changed, 4 insertions(+)

r~

#20 lore raw

PATCH 8/11 target/Kconfig: Allow targets to use Kconfig

In reply to Philippe Mathieu-Daudé

Allow targets to select target-specific Kconfig values.

---
 Makefile       | 6 ++++--
 target/Kconfig | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100644 target/Kconfig
Makefile +4 -2
index 1cf9d76ce7..e402c33811 100644
@@ -421,9 +421,11 @@ MINIKCONF_ARGS = \
 
 MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host \
                    $(SRC_PATH)/accel/Kconfig \
-                   $(SRC_PATH)/hw/Kconfig
+                   $(SRC_PATH)/hw/Kconfig \
+                   $(SRC_PATH)/target/Kconfig
 MINIKCONF_DEPS = $(MINIKCONF_INPUTS) \
-                 $(wildcard $(SRC_PATH)/hw/*/Kconfig)
+                 $(wildcard $(SRC_PATH)/hw/*/Kconfig) \
+                 $(wildcard $(SRC_PATH)/target/*/Kconfig)
 MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
 
 $(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIKCONF_DEPS) $(BUILD_DIR)/config-host.mak
target/Kconfig new file +1 -0
new file mode 100644
index 0000000000..8b13789179
@@ -0,0 +1 @@
+
Signature · 1 line
2.21.1
Reviewed-by on v1 8/11
#21 lore raw

Re: [PATCH 08/11] target/Kconfig: Allow targets to use Kconfig

target/Kconfig line 1

Quoted 7 lines · Philippe Mathieu-Daudé
target/Kconfig new file +1 -0
new file mode 100644
index 0000000000..8b13789179
@@ -0,0 +1 @@
+

Does this want a

# This file intentionally left blank.

?

Otherwise,

r~

#22 lore raw

PATCH 9/11 target/mips: Always enable CONFIG_SEMIHOSTING

In reply to Philippe Mathieu-Daudé

On MIPS, the semihosting feature is always required on user-space.

---
 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
default-configs/mips-linux-user-common.mak new file +4 -0
new file mode 100644
index 0000000000..04947706e8
@@ -0,0 +1,4 @@
+# Common mips*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
default-configs/mips-linux-user.mak +2 -0
index 31df57021e..c606e12444 100644
@@ -1 +1,3 @@
 # Default configuration for mips-linux-user
+
+include mips-linux-user-common.mak
default-configs/mips64-linux-user.mak +2 -0
index 1598bfcf7d..81e16ac2eb 100644
@@ -1 +1,3 @@
 # Default configuration for mips64-linux-user
+
+include mips-linux-user-common.mak
default-configs/mips64el-linux-user.mak +2 -0
index 629f084086..6399af3fd5 100644
@@ -1 +1,3 @@
 # Default configuration for mips64el-linux-user
+
+include mips-linux-user-common.mak
default-configs/mipsel-linux-user.mak +2 -0
index 4d0e4afb69..4a27d30b45 100644
@@ -1 +1,3 @@
 # Default configuration for mipsel-linux-user
+
+include mips-linux-user-common.mak
default-configs/mipsn32-linux-user.mak +2 -0
index 5b97919794..f3ac967463 100644
@@ -1 +1,3 @@
 # Default configuration for mipsn32-linux-user
+
+include mips-linux-user-common.mak
default-configs/mipsn32el-linux-user.mak +2 -0
index d6367ff987..63fe4de4fd 100644
@@ -1 +1,3 @@
 # Default configuration for mipsn32el-linux-user
+
+include mips-linux-user-common.mak
Signature · 1 line
2.21.1
Reviewed-by on v1 9/11
#23 lore raw

Re: [PATCH 09/11] target/mips: Always enable CONFIG_SEMIHOSTING

Quoted 13 lines · Philippe Mathieu-Daudé

On MIPS, the semihosting feature is always required on user-space.

---
 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

r~

#24 lore raw

Re: [PATCH 09/11] target/mips: Always enable CONFIG_SEMIHOSTING

In reply to Philippe Mathieu-Daudé

default-configs/mips-linux-user-common.mak line 4

Quoted 10 lines · Philippe Mathieu-Daudé
default-configs/mips-linux-user-common.mak new file +4 -0
new file mode 100644
index 0000000000..04947706e8
@@ -0,0 +1,4 @@
+# Common mips*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y

If it is always required, it should be select-ed.

Same for patch 10.

Paolo

#25 lore raw

Re: [PATCH 09/11] target/mips: Always enable CONFIG_SEMIHOSTING

Hi Paolo,

TLDR "how can I select a arch-specific feature?"

Quoted 13 lines · Paolo Bonzini

default-configs/mips-linux-user-common.mak line 4

Quoted 10 lines · Philippe Mathieu-Daudé
default-configs/mips-linux-user-common.mak new file +4 -0
new file mode 100644
index 0000000000..04947706e8
@@ -0,0 +1,4 @@
+# Common mips*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y

If it is always required, it should be select-ed.

I'm not sure how to do that...

Currently we have in hw/semihosting/Kconfig:

config SEMIHOSTING
bool
depends on TCG
default n

The only per-target generic entry point is minikconf command line.

1/ The less ugly option might be to add an optional target-devices.mak:

-- >8 --

Makefile.target +1 -0
@@ -5,6 +5,7 @@ BUILD_DIR?=$(CURDIR)/..
 include ../config-host.mak
 include config-target.mak
 include $(SRC_PATH)/rules.mak
+-include $(SRC_PATH)/target/$(TARGET_BASE_ARCH)/target-devices.mak
 
 ifdef CONFIG_SOFTMMU
 include config-devices.mak
target/arm/target-devices.mak new file +1 -0
new file mode 100644
@@ -0,0 +1 @@
+CONFIG_SEMIHOSTING=y

---

2/ I can have ./configure adding in config-devices.mak:

-- >8 --
@@ -7778,6 +7778,7 @@ echo "# Automatically generated by configure - do not modify" > $config_target_m

bflt="no"
mttcg="no"
+target_require_semihosting="no"
interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") gdb_xml_files=""

@@ -7806,6 +7807,7 @@ case "$target_name" in

     TARGET_SYSTBL_ABI=common,oabi
     bflt="yes"
     mttcg="yes"

+ target_require_semihosting="yes"
gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
;;
aarch64|aarch64_be)
@@ -7813,6 +7815,7 @@ case "$target_name" in

     TARGET_BASE_ARCH=arm
     bflt="yes"
     mttcg="yes"

+ target_require_semihosting="yes"
gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml
arm-vfp.xml arm-vfp3.xml arm-neon.xml"
;;
cris)
@@ -8031,7 +8034,10 @@ fi
if test "$target_bsd_user" = "yes" ; then
echo "CONFIG_BSD_USER=y" >> $config_target_mak
fi

+if test "$target_require_semihosting" = "yes" ; then
+ echo "$target/config-devices.mak: CONFIG_SEMIHOSTING=y" >> $config_host_mak +fi
---

3/ Or force MINIKCONF_ARGS:

---
if test "$target_require_semihosting" = "yes" ; then
echo "MINIKCONF_ARGS += CONFIG_SEMIHOSTING=y" >> $config_target_mak
fi
---

Also note for ARM all configs require it, but for MIPS we only want it for user-mode.

With 1/ this can be done as:

-- >8 --

target/mips/target-devices.mak new file +3 -0
new file mode 100644
@@ -0,0 +1,3 @@
+ifndef CONFIG_SOFTMMU
+CONFIG_SEMIHOSTING=y
+endif

---

Quoted 5 lines

Same for patch 10.

Paolo

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAP+75-W0PVH+Gmo3-4qq8Of7ss=Zr4FLVUrxc+nwwdqakHy=Uw@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAP+75-XGxAnc_xVReTXicPhUAGjq_Q4D5Dpw3yd=6ayAFjSftw@mail.gmail.com

#31 lore raw

Re: [PATCH 09/11] target/mips: Always enable CONFIG_SEMIHOSTING

Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines

Let's then:

1) allow multiply-defined variables (just remove the "if" from do_declaration)

Apparently not needed with 2)

Since "config SEMIHOSTING" is in hw/semihosting/Kconfig, it should be needed no?

Quoted 8 lines
Quoted 6 lines

2) do

config SEMIHOSTING
default y if TCG

in target/arm/Kconfig.

You rock!

#32 lore raw

Re: [PATCH 09/11] target/mips: Always enable CONFIG_SEMIHOSTING

In reply to a message not in the archive
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 2 lines

You can add CONFIG_SEMIHOSTING=y directly in the Kconfig file.

I didn't know because it is not documented and no examples, but I the code is here:

    # assignment_var: ID (starting with "CONFIG_")
    def parse_assignment_var(self):
        if self.tok == TOK_ID:
            val = self.val
            if not val.startswith("CONFIG_"):
                raise KconfigParserError(self, 'Expected identifier starting with "CONFIG_"', TOK_NONE)
            self.get_token()
            return self.data.do_var(val[7:])
        else:
            raise KconfigParserError(self, 'Expected identifier')

    # assignment: var EQUAL y_or_n
    def parse_assignment(self):
        var = self.parse_assignment_var()
        if self.tok != TOK_EQUAL:
            raise KconfigParserError(self, 'Expected "="') self.get_token() self.data.do_assignment(var, self.parse_y_or_n())

Quoted 1 line

Thanks!

Well yeah, it's a bit of a hack and simply the simplest way to implement it. If it turns out that there are other ways to achieve what you need, it's better.

Paolo

#33 lore raw

PATCH 10/11 target/arm: Always enable CONFIG_SEMIHOSTING

In reply to Philippe Mathieu-Daudé

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

---
 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
default-configs/aarch64-linux-user-common.mak new file +4 -0
new file mode 100644
index 0000000000..94c0cdf826
@@ -0,0 +1,4 @@
+# Common aarch64*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
default-configs/aarch64-linux-user.mak +2 -0
index 0a5b08a007..d27232cbc6 100644
@@ -1 +1,3 @@
 # Default configuration for aarch64-linux-user
+
+include aarch64-linux-user-common.mak
default-configs/aarch64_be-linux-user.mak +2 -0
index a69d9d2e41..7dee7ba4cb 100644
@@ -1 +1,3 @@
 # Default configuration for aarch64_be-linux-user
+
+include aarch64-linux-user-common.mak
default-configs/arm-linux-user-common.mak new file +4 -0
new file mode 100644
index 0000000000..67acd961f3
@@ -0,0 +1,4 @@
+# Common arm*-linux-user CONFIG defines
+
+# CONFIG_SEMIHOSTING is always required on this architecture
+CONFIG_SEMIHOSTING=y
default-configs/arm-linux-user.mak +2 -0
index 413361a022..7d45e4d20a 100644
@@ -1 +1,3 @@
 # Default configuration for arm-linux-user
+
+include arm-linux-user-common.mak
default-configs/arm-softmmu.mak +3 -1
index 36a0e89daa..8b89d8c4c0 100644
@@ -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
 
@@ -40,5 +43,4 @@ CONFIG_MICROBIT=y
 CONFIG_FSL_IMX25=y
 CONFIG_FSL_IMX7=y
 CONFIG_FSL_IMX6UL=y
-CONFIG_SEMIHOSTING=y
 CONFIG_ALLWINNER_H3=y
default-configs/armeb-linux-user.mak +2 -0
index bf2ffe7038..485132f606 100644
@@ -1 +1,3 @@
 # Default configuration for armeb-linux-user
+
+include arm-linux-user-common.mak
Signature · 1 line
2.21.1
Reviewed-by on v1 10/11
#34 lore raw

Re: [PATCH 10/11] target/arm: Always enable CONFIG_SEMIHOSTING

Quoted 4 lines · Philippe Mathieu-Daudé

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

Quoted 11 lines
---
 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

r~

#35 lore raw

PATCH 11/11 hw/semihosting: Make the feature depend of TCG, and allow to disable it

In reply to Philippe Mathieu-Daudé

The semihosting feature is only meaningful when using TCG.

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.

---
 hw/semihosting/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/semihosting/Kconfig +3 -1
index efe0a30734..06e9262af2 100644
@@ -1,3 +1,5 @@
 
 config SEMIHOSTING
-       bool
+    bool
+    depends on TCG
+    default n
Signature · 1 line
2.21.1
#36 lore raw

Re: [PATCH 11/11] hw/semihosting: Make the feature depend of TCG, and allow to disable it

Quoted 4 lines · Philippe Mathieu-Daudé

The semihosting feature is only meaningful when using TCG.

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

Also m68k, nios2, xtensa. riscv eventually but not yet upstream.

Quoted 14 lines

Do not enable it by default, and let the few targets requiring it to manually select it.

---
 hw/semihosting/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/semihosting/Kconfig +0 -0
index efe0a30734..06e9262af2 100644

hw/semihosting/Kconfig line 5

Quoted 6 lines
hw/semihosting/Kconfig +3 -1
@@ -1,3 +1,5 @@
 
 config SEMIHOSTING
-       bool
+    bool
+    depends on TCG
+    default n

OK, this is the "do not enable by default" -- where is the "but do enable by default for the targets that use it" part of the config change ?

thanks
-- PMM

#37 lore raw

Re: [PATCH 11/11] hw/semihosting: Make the feature depend of TCG, and allow to disable it

Quoted 23 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé

The semihosting feature is only meaningful when using TCG.

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

Also m68k, nios2, xtensa. riscv eventually but not yet upstream.

Quoted 15 lines

Do not enable it by default, and let the few targets requiring it to manually select it.

---
  hw/semihosting/Kconfig | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/semihosting/Kconfig +0 -0
index efe0a30734..06e9262af2 100644
@@ -1,3 +1,5 @@
 
Quoted 9 lines

hw/semihosting/Kconfig line 5

Quoted 5 lines
hw/semihosting/Kconfig +3 -1
  config SEMIHOSTING
-       bool
+    bool
+    depends on TCG
+    default n

OK, this is the "do not enable by default" -- where is the "but do enable by default for the targets that use it" part of the config change ?

This is already the default for these targets, see:

commit 16932bb761e52c2ca9397b57af5bdc5bdc5ae6a4

Author: Alex Bennée <[email protected]>
Date:   Mon May 13 15:25:27 2019 +0100

semihosting: introduce CONFIG_SEMIHOSTING

There isn't much point building semihosting for platforms that don't support it. Introduce a new symbol and enable it only for the softmmu targets that need it.

I'll add that information in the description.

Quoted 4 lines

thanks
-- PMM

Reviewed-by on v1 11/11
#38 lore raw

Re: [PATCH 11/11] hw/semihosting: Make the feature depend of TCG, and allow to disable it

In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

The semihosting feature is only meaningful when using TCG.

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.

---
 hw/semihosting/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

r~