On Fri, 2026-08-28 at 16:57 +0530, Subrahmanya Lingappa wrote:
> Add a meson option and config probe for librpmi so RISC-V machines
> can
> opt into RPMI support when the library is available. Keep the
> dependency
> optional so default builds without librpmi continue to work.
> 
> Signed-off-by: Subrahmanya Lingappa
> <[email protected]>
> Reviewed-by: Daniel Henrique Barboza
> <[email protected]>
> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

Reviewed-by: Alistair Francis <[email protected]>

Alistair

> ---
>  Kconfig.host                  |  3 +++
>  meson.build                   | 14 ++++++++++++++
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  3 +++
>  4 files changed, 22 insertions(+)
> 
> diff --git a/Kconfig.host b/Kconfig.host
> index 933425c74b..6f98dadb2e 100644
> --- a/Kconfig.host
> +++ b/Kconfig.host
> @@ -8,6 +8,9 @@ config LINUX
>  config LIBCBOR
>      bool
>  
> +config LIBRPMI
> +    bool
> +
>  config GNUTLS
>      bool
>  
> diff --git a/meson.build b/meson.build
> index 6dcfdceb50..1e1e19e655 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2018,6 +2018,17 @@ if lzo.found() and not cc.links('''
>    endif
>  endif
>  
> +librpmi = not_found
> +if not get_option('librpmi').auto() or have_system
> +  librpmi = dependency('librpmi', required: get_option('librpmi'),
> +                       method: 'pkg-config')
> +  if librpmi.found() and not cc.has_header_symbol('librpmi.h',
> +                                                 
> 'rpmi_service_group_syssusp_create',
> +                                                  dependencies:
> librpmi)
> +    error('librpmi support requires the RPMI system suspend service
> group API')
> +  endif
> +endif
> +
>  numa = not_found
>  if not get_option('numa').auto() or have_system or have_tools
>    numa = cc.find_library('numa', has_headers: ['numa.h'],
> @@ -2440,6 +2451,7 @@ config_host_data.set('CONFIG_LINUX', host_os ==
> 'linux')
>  config_host_data.set('CONFIG_POSIX', host_os != 'windows')
>  config_host_data.set('CONFIG_WIN32', host_os == 'windows')
>  config_host_data.set('CONFIG_LZO', lzo.found())
> +config_host_data.set('CONFIG_LIBRPMI', librpmi.found())
>  config_host_data.set('CONFIG_MPATH', mpathpersist.found())
>  config_host_data.set('CONFIG_BLKIO', blkio.found())
>  if blkio.found()
> @@ -3272,6 +3284,7 @@ host_kconfig = \
>    (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) +
> \
>    (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y']
> : []) + \
>    (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : []) + \
> +  (librpmi.found() ? ['CONFIG_LIBRPMI=y'] : []) + \
>    (have_rust ? ['CONFIG_HAVE_RUST=y'] : [])
>  
>  ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR' ]
> @@ -4988,6 +5001,7 @@ summary_info += {'TPM support':       have_tpm}
>  summary_info += {'IGVM support':      igvm}
>  summary_info += {'libssh support':    libssh}
>  summary_info += {'lzo support':       lzo}
> +summary_info += {'RPMI support':      librpmi}
>  summary_info += {'snappy support':    snappy}
>  summary_info += {'bzip2 support':     libbzip2}
>  summary_info += {'lzfse support':     liblzfse}
> diff --git a/meson_options.txt b/meson_options.txt
> index a07cb47d35..a65af0e633 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -204,6 +204,8 @@ option('lzfse', type : 'feature', value : 'auto',
>         description: 'lzfse support for DMG images')
>  option('lzo', type : 'feature', value : 'auto',
>         description: 'lzo compression support')
> +option('librpmi', type : 'feature', value : 'auto',
> +       description: 'RPMI support')
>  option('pvg', type: 'feature', value: 'auto',
>         description: 'macOS paravirtualized graphics support')
>  option('rbd', type : 'feature', value : 'auto',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-
> buildoptions.sh
> index c003985047..12179f6024 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -140,6 +140,7 @@ meson_options_help() {
>    printf "%s\n" '  libkeyutils     Linux keyutils support'
>    printf "%s\n" '  libnfs          libnfs block device driver'
>    printf "%s\n" '  libpmem         libpmem support'
> +  printf "%s\n" '  librpmi         RPMI support'
>    printf "%s\n" '  libssh          ssh block device support'
>    printf "%s\n" '  libudev         Use libudev to enumerate host
> devices'
>    printf "%s\n" '  libusb          libusb support for USB
> passthrough'
> @@ -376,6 +377,8 @@ _meson_option_parse() {
>      --disable-libnfs) printf "%s" -Dlibnfs=disabled ;;
>      --enable-libpmem) printf "%s" -Dlibpmem=enabled ;;
>      --disable-libpmem) printf "%s" -Dlibpmem=disabled ;;
> +    --enable-librpmi) printf "%s" -Dlibrpmi=enabled ;;
> +    --disable-librpmi) printf "%s" -Dlibrpmi=disabled ;;
>      --enable-libssh) printf "%s" -Dlibssh=enabled ;;
>      --disable-libssh) printf "%s" -Dlibssh=disabled ;;
>      --enable-libudev) printf "%s" -Dlibudev=enabled ;;

Reply via email to