qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 1/2] Adding Kconfig options for custom CSR support and Andes


From: Ruinland Chuan-Tzu Tsai
Subject: [RFC PATCH 1/2] Adding Kconfig options for custom CSR support and Andes CPU model
Date: Thu, 26 Aug 2021 23:13:31 +0800

From: Ruinland ChuanTzu Tsai <ruinland@andestech.com>

Introduce Kconfig to target/riscv/Kconfig.
RISCV_CUSTOM_CSR will be toggled if ANDES_CORE is selected.

We need to modify meson.build for handling linux-user in a reasonable way.
Otherwise, all Kconfig options goes into *-config-devices.h which won't be
accessible for linux-user mode.
---
 Kconfig              |  1 +
 meson.build          | 26 ++++++++++++++++++++++++++
 target/riscv/Kconfig |  6 ++++++
 3 files changed, 33 insertions(+)
 create mode 100644 target/riscv/Kconfig

diff --git a/Kconfig b/Kconfig
index bf694c4..d2cc9c7 100644
--- a/Kconfig
+++ b/Kconfig
@@ -2,3 +2,4 @@ source Kconfig.host
 source backends/Kconfig
 source accel/Kconfig
 source hw/Kconfig
+source ./target/riscv/Kconfig
diff --git a/meson.build b/meson.build
index 736810e..8a8413d 100644
--- a/meson.build
+++ b/meson.build
@@ -1315,7 +1315,33 @@ foreach target : target_dirs
     endif
   endforeach
 
+
   config_target_data = configuration_data()
+
+  #Parse RISC-V custom definitions in advance. FIXME: rewrite core detection
+  if config_target['TARGET_BASE_ARCH'] == 'riscv'
+    config_riscv_custom_mak = 'riscv-custom-' + target + '-config-target.mak'
+    config_riscv_custom_mak = configure_file(
+      input: ['default-configs/targets/rv_custom' / target + '.mak', 
'Kconfig'],
+      output: config_riscv_custom_mak,
+      depfile: config_riscv_custom_mak + '.d',
+      capture: true,
+      command: [minikconf,
+                get_option('default_devices') ? '--defconfig' : 
'--allnoconfig',
+                config_riscv_custom_mak, '@DEPFILE@', '@INPUT@',
+                host_kconfig, accel_kconfig])
+
+    rvcustom_parse = keyval.load(config_riscv_custom_mak)
+    foreach k, v : rvcustom_parse
+      if k == 'CONFIG_RISCV_CUSTOM_CSR'
+        config_target_data.set(k, 1)
+      endif
+      if k == 'CONFIG_ANDES_CORE'
+        config_target_data.set(k, 1)
+      endif
+    endforeach
+  endif
+
   foreach k, v: config_target
     if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
       # do nothing
diff --git a/target/riscv/Kconfig b/target/riscv/Kconfig
new file mode 100644
index 0000000..a0b09aa
--- /dev/null
+++ b/target/riscv/Kconfig
@@ -0,0 +1,6 @@
+config RISCV_CUSTOM_CSR
+    bool
+config ANDES_CORE
+    bool
+    select RISCV_CUSTOM_CSR
+    default n
-- 
2.32.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]