[RFC PATCH v2 0/9] i386/sev: Use C API of Rust SEV library

Tyler Fanelli posted 9 patches 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231004203418.56508-1-tfanelli@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Marcelo Tosatti <mtosatti@redhat.com>
meson.build                   |   8 +
meson_options.txt             |   2 +
scripts/meson-buildoptions.sh |   3 +
subprojects/sev.wrap          |   6 +
target/i386/meson.build       |   2 +-
target/i386/sev.c             | 392 +++++++++++-----------------------
target/i386/sev.h             |   6 +-
target/i386/trace-events      |   1 +
8 files changed, 148 insertions(+), 272 deletions(-)
create mode 100644 subprojects/sev.wrap
[RFC PATCH v2 0/9] i386/sev: Use C API of Rust SEV library
Posted by Tyler Fanelli 7 months, 1 week ago
These patches are submitted as an RFC mainly because I'm a relative
newcomer to QEMU with no knowledge of the community's views on
including Rust code, nor it's preference of using library APIs for
ioctls that were previously implemented in QEMU directly.

Recently, the Rust sev library [0] has introduced a C API to take
advantage of the library outside of Rust.

Should the inclusion of the library as a dependency be desired, it can
be extended further to include the firmware/platform ioctls and more.
This would result in much of the AMD-SEV portion of QEMU being offloaded
to the library.

This series looks to explore the possibility of using the library and
show a bit of what it would look like. I'm looking for comments
regarding if this feature is desired.

[0] https://github.com/virtee/sev

NOTE: The required meson changes in the Rust library are not merged yet.
Therefore, the git repository URL in subprojects/sev.wrap points to a
personal fork of the library (for testing purposes). The meson patches
for the library are required before these patches can be merged.

Changes since v1:
- Add sev Rust library as a QEMU subproject, rather than using
  pkg-config for linking
- Rebased to upstream/master
- Use C API for SEV_ATTESTATION_REPORT ioctl

Tyler Fanelli (9):
  Add Rust SEV library as subproject
  i386/sev: Replace INIT and ES_INIT ioctls with sev library equivalents
  i386/sev: Replace LAUNCH_START ioctl with sev library equivalent
  i386/sev: Replace UPDATE_DATA ioctl with sev library equivalent
  i386/sev: Replace LAUNCH_UPDATE_VMSA ioctl with sev library equivalent
  i386/sev: Replace LAUNCH_MEASURE ioctl with sev library equivalent
  i386/sev: Replace LAUNCH_SECRET ioctl with sev library equivalent
  i386/sev: Replace LAUNCH_FINISH ioctl with sev library equivalent
  i386/sev: Replace SEV_ATTESTATION_REPORT with sev library equivalent

 meson.build                   |   8 +
 meson_options.txt             |   2 +
 scripts/meson-buildoptions.sh |   3 +
 subprojects/sev.wrap          |   6 +
 target/i386/meson.build       |   2 +-
 target/i386/sev.c             | 392 +++++++++++-----------------------
 target/i386/sev.h             |   6 +-
 target/i386/trace-events      |   1 +
 8 files changed, 148 insertions(+), 272 deletions(-)
 create mode 100644 subprojects/sev.wrap

-- 
2.40.1