Re: [PATCH v3 04/11] accel: Add Nitro Enclaves accelerator

Philippe Mathieu-Daudé <[email protected]> Thu, 30 Jul 2026 06:10:44 +0200
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
Hi Alex,

(now committed as 8155bca60d436e6422ee08be3b93c952540e45da)

On 25/2/26 23:07, Alexander Graf wrote:
> Nitro Enclaves are a confidential compute technology which
> allows a parent instance to carve out resources from itself
> and spawn a confidential sibling VM next to itself. Similar
> to other confidential compute solutions, this sibling is
> controlled by an underlying vmm, but still has a higher level
> vmm (QEMU) to implement some of its I/O functionality and
> lifecycle.
> 
> Add an accelerator to drive this interface. In combination with
> follow-on patches to enhance the Nitro Enclaves machine model, this
> will allow users to run a Nitro Enclave using QEMU.
> 
> Signed-off-by: Alexander Graf <[email protected]>
> 
> ---
> 
> v1 -> v2:
> 
>    - Use dummy, move cpu init to post
>    - Trigger nitro-vsock-bridge instead of QOM properties
> 
> v2 -> v3:
> 
>    - Mark as no reboot
> ---
>   MAINTAINERS                   |   6 +
>   accel/Kconfig                 |   3 +
>   accel/meson.build             |   1 +
>   accel/nitro/meson.build       |   3 +
>   accel/nitro/nitro-accel.c     | 284 ++++++++++++++++++++++++++++++++++
>   accel/nitro/trace-events      |   6 +
>   accel/nitro/trace.h           |   2 +
>   accel/stubs/meson.build       |   1 +
>   accel/stubs/nitro-stub.c      |  11 ++
>   include/system/hw_accel.h     |   1 +
>   include/system/nitro-accel.h  |  25 +++
>   meson.build                   |  11 ++
>   meson_options.txt             |   2 +
>   qemu-options.hx               |   8 +-
>   scripts/meson-buildoptions.sh |   3 +
>   15 files changed, 363 insertions(+), 4 deletions(-)
>   create mode 100644 accel/nitro/meson.build
>   create mode 100644 accel/nitro/nitro-accel.c
>   create mode 100644 accel/nitro/trace-events
>   create mode 100644 accel/nitro/trace.h
>   create mode 100644 accel/stubs/nitro-stub.c
>   create mode 100644 include/system/nitro-accel.h


> diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h
> index 628a50e066..f0c10b6d80 100644
> --- a/include/system/hw_accel.h
> +++ b/include/system/hw_accel.h
> @@ -17,6 +17,7 @@
>   #include "system/mshv.h"
>   #include "system/whpx.h"
>   #include "system/nvmm.h"
> +#include "system/nitro-accel.h"
>   
>   /**
>    * cpu_synchronize_state:

Is this line deliberately missing?

-- >8 --
diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h
index f0c10b6d805..68716b2cfc6 100644
--- a/include/system/hw_accel.h
+++ b/include/system/hw_accel.h
@@ -50,6 +50,7 @@ static inline bool hwaccel_enabled(void)
  {
      return hvf_enabled()
          || kvm_enabled()
+        || nitro_enabled()
          || nvmm_enabled()
          || whpx_enabled();
  }
---

> diff --git a/include/system/nitro-accel.h b/include/system/nitro-accel.h
> new file mode 100644
> index 0000000000..a93aa6fb00
> --- /dev/null
> +++ b/include/system/nitro-accel.h
> @@ -0,0 +1,25 @@
> +/*
> + * Nitro Enclaves accelerator - public interface
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef SYSTEM_NITRO_ACCEL_H
> +#define SYSTEM_NITRO_ACCEL_H
> +
> +#include "qemu/accel.h"
> +
> +extern bool nitro_allowed;
> +
> +static inline bool nitro_enabled(void)
> +{
> +    return nitro_allowed;
> +}
> +
> +#define TYPE_NITRO_ACCEL ACCEL_CLASS_NAME("nitro")
> +
> +typedef struct NitroAccelState NitroAccelState;
> +DECLARE_INSTANCE_CHECKER(NitroAccelState, NITRO_ACCEL,
> +                         TYPE_NITRO_ACCEL)
> +
> +#endif /* SYSTEM_NITRO_ACCEL_H */