[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject
|
From: |
Stefan Hajnoczi |
|
Subject: |
Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject |
|
Date: |
Thu, 5 Oct 2023 11:54:48 -0400 |
On Wed, Oct 04, 2023 at 04:34:10PM -0400, Tyler Fanelli wrote:
> The Rust sev library provides a C API for the AMD SEV launch ioctls, as
> well as the ability to build with meson. Add the Rust sev library as a
> QEMU subproject with the goal of outsourcing all SEV launch ioctls to C
> APIs provided by it.
>
> Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
> ---
> meson.build | 8 ++++++++
> meson_options.txt | 2 ++
> scripts/meson-buildoptions.sh | 3 +++
> subprojects/sev.wrap | 6 ++++++
> target/i386/meson.build | 2 +-
> 5 files changed, 20 insertions(+), 1 deletion(-)
> create mode 100644 subprojects/sev.wrap
>
> diff --git a/meson.build b/meson.build
> index 20ceeb8158..8a17c29de8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -960,6 +960,13 @@ if not get_option('slirp').auto() or have_system
> endif
> endif
>
> +sev = not_found
> +if not get_option('sev').auto()
When 'sev' is auto, then it won't be built. That seems strange. The
auto-detection part is missing! I did you test this on a system that
doesn't have libsev installed system-wide?
I guess the auto-detection would look something like:
cargo = find_program('cargo', required: true)
if not get_option('sev').auto() or cargo.found()
...
That way 'sev' is only built automatically on systems that have cargo
installed.
> + sev = dependency('sev',
> + method: 'pkg-config',
> + required: get_option('sev'))
> +endif
If you update the auto logic, see the documentation about fallbacks to
subprojects for optional dependencies:
https://mesonbuild.com/Wrap-dependency-system-manual.html#provide-section
It might be necessary to add dependency(..., fallback='sev').
> +
> vde = not_found
> if not get_option('vde').auto() or have_system or have_tools
> vde = cc.find_library('vdeplug', has_headers: ['libvdeplug.h'],
> @@ -4331,6 +4338,7 @@ summary_info += {'libudev': libudev}
> # Dummy dependency, keep .found()
> summary_info += {'FUSE lseek': fuse_lseek.found()}
> summary_info += {'selinux': selinux}
> +summary_info += {'sev': sev}
> summary_info += {'libdw': libdw}
> summary(summary_info, bool_yn: true, section: 'Dependencies')
>
> diff --git a/meson_options.txt b/meson_options.txt
> index 57e265c871..5b8d283717 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -204,6 +204,8 @@ option('sdl_image', type : 'feature', value : 'auto',
> description: 'SDL Image support for icons')
> option('seccomp', type : 'feature', value : 'auto',
> description: 'seccomp support')
> +option('sev', type : 'feature', value : 'auto',
> + description: 'Rust AMD SEV library')
> option('smartcard', type : 'feature', value : 'auto',
> description: 'CA smartcard emulation support')
> option('snappy', type : 'feature', value : 'auto',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index e4b46d5715..e585a548fa 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -161,6 +161,7 @@ meson_options_help() {
> printf "%s\n" ' sdl-image SDL Image support for icons'
> printf "%s\n" ' seccomp seccomp support'
> printf "%s\n" ' selinux SELinux support in qemu-nbd'
> + printf "%s\n" ' sev SEV library support'
> printf "%s\n" ' slirp libslirp user mode network backend
> support'
> printf "%s\n" ' slirp-smbd use smbd (at path --smbd=*) in slirp
> networking'
> printf "%s\n" ' smartcard CA smartcard emulation support'
> @@ -440,6 +441,8 @@ _meson_option_parse() {
> --disable-seccomp) printf "%s" -Dseccomp=disabled ;;
> --enable-selinux) printf "%s" -Dselinux=enabled ;;
> --disable-selinux) printf "%s" -Dselinux=disabled ;;
> + --enable-sev) printf "%s" -Dsev=enabled ;;
> + --disable-sev) printf "%s" -Dsev=disabled ;;
> --enable-slirp) printf "%s" -Dslirp=enabled ;;
> --disable-slirp) printf "%s" -Dslirp=disabled ;;
> --enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;;
> diff --git a/subprojects/sev.wrap b/subprojects/sev.wrap
> new file mode 100644
> index 0000000000..5be1faccf6
> --- /dev/null
> +++ b/subprojects/sev.wrap
> @@ -0,0 +1,6 @@
> +[wrap-git]
> +url = https://github.com/tylerfanelli/sev
> +revision = b81b1da5df50055600a5b0349b0c4afda677cccb
> +
> +[provide]
> +sev = sev_dep
> diff --git a/target/i386/meson.build b/target/i386/meson.build
> index 6f1036d469..8972a4fb17 100644
> --- a/target/i386/meson.build
> +++ b/target/i386/meson.build
> @@ -20,7 +20,7 @@ i386_system_ss.add(files(
> 'monitor.c',
> 'cpu-sysemu.c',
> ))
> -i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false:
> files('sev-sysemu-stub.c'))
> +i386_system_ss.add(when: 'CONFIG_SEV', if_true: [sev, files('sev.c')],
> if_false: files('sev-sysemu-stub.c'))
>
> i386_user_ss = ss.source_set()
>
> --
> 2.40.1
>
signature.asc
Description: PGP signature
- [RFC PATCH v2 6/9] i386/sev: Replace LAUNCH_MEASURE ioctl with sev library equivalent, (continued)
- [RFC PATCH v2 6/9] i386/sev: Replace LAUNCH_MEASURE ioctl with sev library equivalent, Tyler Fanelli, 2023/10/04
- [RFC PATCH v2 4/9] i386/sev: Replace UPDATE_DATA ioctl with sev library equivalent, Tyler Fanelli, 2023/10/04
- [RFC PATCH v2 2/9] i386/sev: Replace INIT and ES_INIT ioctls with sev library equivalents, Tyler Fanelli, 2023/10/04
- [RFC PATCH v2 7/9] i386/sev: Replace LAUNCH_SECRET ioctl with sev library equivalent, Tyler Fanelli, 2023/10/04
- [RFC PATCH v2 5/9] i386/sev: Replace LAUNCH_UPDATE_VMSA ioctl with sev library equivalent, Tyler Fanelli, 2023/10/04
- [RFC PATCH v2 8/9] i386/sev: Replace LAUNCH_FINISH ioctl with sev library equivalent, Tyler Fanelli, 2023/10/04
- [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Tyler Fanelli, 2023/10/04
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Philippe Mathieu-Daudé, 2023/10/05
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject,
Stefan Hajnoczi <=
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Tyler Fanelli, 2023/10/10
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Manos Pitsidianakis, 2023/10/13
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Tyler Fanelli, 2023/10/13
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Daniel P . Berrangé, 2023/10/16
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Philippe Mathieu-Daudé, 2023/10/16
- Re: [RFC PATCH v2 1/9] Add Rust SEV library as subproject, Stefan Hajnoczi, 2023/10/16
[RFC PATCH v2 9/9] i386/sev: Replace SEV_ATTESTATION_REPORT with sev library equivalent, Tyler Fanelli, 2023/10/04