diff mbox series

[RFC,v4,1/4] Add options to config/meson files for custom CSR

Message ID 20210805175626.11573-2-ruinland@andestech.com
State New
Headers show
Series Add basic support for custom CSR | expand

Commit Message

Ruinland ChuanTzu Tsai Aug. 5, 2021, 5:56 p.m. UTC
From: Ruinland ChuanTzu Tsai <ruinland@andestech.com>

Adding option `riscv_custom` to configure script, meson.build and
meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom
instructions handling logic.

Signed-off-by: Dylan Jhong <dylan@andestech.com>
---
 configure         | 6 ++++++
 meson.build       | 2 ++
 meson_options.txt | 2 ++
 3 files changed, 10 insertions(+)

Comments

Bin Meng Aug. 6, 2021, 2:39 a.m. UTC | #1
On Fri, Aug 6, 2021 at 1:57 AM Ruinland Chuan-Tzu Tsai
<ruinland@andestech.com> wrote:
>
> From: Ruinland ChuanTzu Tsai <ruinland@andestech.com>
>
> Adding option `riscv_custom` to configure script, meson.build and
> meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom
> instructions handling logic.
>
> Signed-off-by: Dylan Jhong <dylan@andestech.com>
> ---
>  configure         | 6 ++++++
>  meson.build       | 2 ++
>  meson_options.txt | 2 ++
>  3 files changed, 10 insertions(+)
>

This sounds like unnecessary to bring such a config option to the meson level.

I believe a Kconfig option should just be fine.

Regards,
Bin
Bin Meng Aug. 6, 2021, 2:41 a.m. UTC | #2
On Fri, Aug 6, 2021 at 10:39 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Fri, Aug 6, 2021 at 1:57 AM Ruinland Chuan-Tzu Tsai
> <ruinland@andestech.com> wrote:
> >
> > From: Ruinland ChuanTzu Tsai <ruinland@andestech.com>
> >
> > Adding option `riscv_custom` to configure script, meson.build and
> > meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom
> > instructions handling logic.
> >
> > Signed-off-by: Dylan Jhong <dylan@andestech.com>
> > ---
> >  configure         | 6 ++++++
> >  meson.build       | 2 ++
> >  meson_options.txt | 2 ++
> >  3 files changed, 10 insertions(+)
> >
>
> This sounds like unnecessary to bring such a config option to the meson level.
>
> I believe a Kconfig option should just be fine.

+Alistair
diff mbox series

Patch

diff --git a/configure b/configure
index 34fccaa..88f6584 100755
--- a/configure
+++ b/configure
@@ -324,6 +324,7 @@  virtiofsd="auto"
 virtfs="auto"
 libudev="auto"
 mpath="auto"
+riscv_custom="auto"
 vnc="enabled"
 sparse="auto"
 vde="$default_feature"
@@ -1016,6 +1017,10 @@  for opt do
   ;;
   --enable-vnc) vnc="enabled"
   ;;
+  --enable-riscv-custom) riscv_custom="enabled"
+  ;;
+  --disable-riscv-custom) riscv_custom="disabled"
+  ;;
   --disable-gettext) gettext="disabled"
   ;;
   --enable-gettext) gettext="enabled"
@@ -6416,6 +6421,7 @@  NINJA=$ninja $meson setup \
         -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
         -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
+        -Driscv_custom=$riscv_custom \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
diff --git a/meson.build b/meson.build
index adeec15..736810e 100644
--- a/meson.build
+++ b/meson.build
@@ -1151,6 +1151,7 @@  config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h'))
 config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
 
 config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>'))
+config_host_data.set('CONFIG_RISCV_CUSTOM', get_option('riscv_custom').enabled())
 
 ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target
 arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
@@ -2694,6 +2695,7 @@  summary_info += {'libpmem support':   config_host.has_key('CONFIG_LIBPMEM')}
 summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
 summary_info += {'libudev':           libudev.found()}
 summary_info += {'FUSE lseek':        fuse_lseek.found()}
+summary_info += {'RISC-V custom CSRs/instructions': get_option('riscv_custom').enabled()}
 summary(summary_info, bool_yn: true, section: 'Dependencies')
 
 if not supported_cpus.contains(cpu)
diff --git a/meson_options.txt b/meson_options.txt
index 9734019..470ef23 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -125,3 +125,5 @@  option('slirp', type: 'combo', value: 'auto',
 option('fdt', type: 'combo', value: 'auto',
        choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
        description: 'Whether and how to find the libfdt library')
+option('riscv_custom', type: 'feature', value: 'auto',
+       description: 'RISC-V custom')