[Top][All Lists]

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

[RFC PATCH 0/2] riscv: Adding custom CSR related Kconfig options

From: Ruinland Chuan-Tzu Tsai
Subject: [RFC PATCH 0/2] riscv: Adding custom CSR related Kconfig options
Date: Thu, 26 Aug 2021 23:13:30 +0800

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

During my modification on my previous patch series for custom CSR support, I
believe this issue deserves its own discussion (or debate) because it's _not_
as simple as "just put those options in Kconfig".

The obstables I've encountered and the kluges I came up is listed as follow :

(1) Due to the design of top-level meson.build, all Kconfig options will land
into `*-config-devices.h` since minikconf will be only used after config_target
being processed. This will let to the fact that linux-users won't be able to
use custom CSR code properly becuase they only includes `*-config-devices.h`.
And that is reasonble due to the fact that changes on cpu.c and csr.c is a 
target-related matter and linux-user mode shouldn't include device related 
headers in most of cases.

So, modify meson.build to parse target/riscv/Kconfig during config_target phase
is without doubts necessary.

(2) Kconfig option `RISCV_CUSTOM_CSR` is introduced for RISC-V cpu models to 
toggle it at its will. Yet due to the fact that csr.o and cpu.o are linked
altogether for all CPU models, the suffer will be shared without option.
The only reasonable way to seperate build the fire lane which seperates vendor
flavored cpu and spec-conformed ones, is to build them seperately with options
toggled diffrently, just like RV32 and RV64 shares almost the same source base,
yet the sources are compiled with differnt flags/definitions.

To achieve that, miraculously, we can just put *.mak files into `target`
directoy, because that's how `configure` enumerates what targets are supported.

(3) The longest days are not over yet, if we take a good look at how the 
is invoked during config_devices and in what way *.mak presented its options
inside `default-configs/devices`, we can see that *.mak files there is formated
in `CONFIG_*` style and the minikconf is reading directly during config_device
phase. That's totally different from *.mak files presented in
`default-configs/targets`. To make the parsing logic consistent, I
introduce a rv_custom directory inside which contains minikconf-parsable
mak files.

With this patches, ones can build a A25/AX25 linux-user platform by :
$ ./configure --target-list=riscv64-andes-linux-user,riscv32-andes-linux-user
$ make

P.S. The pacthes from :
is needed. A clean-up and modified version will be sent out soon.

I know these parts won't be easy to digest, and the further iterations will be
needed, so I didn't ask my colleagues to sign-off for now.

Cordially yours,
Ruinland ChuanTzu Tsai

Ruinland ChuanTzu Tsai (2):
  Adding Kconfig options for custom CSR support and Andes CPU model
  Adding necessary files for Andes platforms, cores to enable custom CSR

 Kconfig                                       |  1 +
 .../devices/riscv32-andes-softmmu.mak         | 17 ++++++++++++
 .../devices/riscv64-andes-softmmu.mak         | 17 ++++++++++++
 .../targets/riscv32-andes-linux-user.mak      |  1 +
 .../targets/riscv32-andes-softmmu.mak         |  1 +
 .../targets/riscv64-andes-linux-user.mak      |  1 +
 .../targets/riscv64-andes-softmmu.mak         |  1 +
 .../targets/rv_custom/no_custom.mak           |  0
 .../rv_custom/riscv32-andes-linux-user.mak    |  1 +
 .../rv_custom/riscv32-andes-softmmu.mak       |  1 +
 .../targets/rv_custom/riscv32-linux-user.mak  |  1 +
 .../targets/rv_custom/riscv32-softmmu.mak     |  1 +
 .../rv_custom/riscv64-andes-linux-user.mak    |  1 +
 .../rv_custom/riscv64-andes-softmmu.mak       |  1 +
 .../targets/rv_custom/riscv64-linux-user.mak  |  1 +
 .../targets/rv_custom/riscv64-softmmu.mak     |  1 +
 meson.build                                   | 26 +++++++++++++++++++
 target/riscv/Kconfig                          |  6 +++++
 18 files changed, 79 insertions(+)
 create mode 100644 default-configs/devices/riscv32-andes-softmmu.mak
 create mode 100644 default-configs/devices/riscv64-andes-softmmu.mak
 create mode 120000 default-configs/targets/riscv32-andes-linux-user.mak
 create mode 120000 default-configs/targets/riscv32-andes-softmmu.mak
 create mode 120000 default-configs/targets/riscv64-andes-linux-user.mak
 create mode 120000 default-configs/targets/riscv64-andes-softmmu.mak
 create mode 100644 default-configs/targets/rv_custom/no_custom.mak
 create mode 100644 
 create mode 100644 default-configs/targets/rv_custom/riscv32-andes-softmmu.mak
 create mode 120000 default-configs/targets/rv_custom/riscv32-linux-user.mak
 create mode 120000 default-configs/targets/rv_custom/riscv32-softmmu.mak
 create mode 100644 
 create mode 100644 default-configs/targets/rv_custom/riscv64-andes-softmmu.mak
 create mode 120000 default-configs/targets/rv_custom/riscv64-linux-user.mak
 create mode 120000 default-configs/targets/rv_custom/riscv64-softmmu.mak
 create mode 100644 target/riscv/Kconfig


reply via email to

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