[RFC/PATCH v2 02/12] accel: Introduce check_capability() callback

Srivatsa Vaddagiri posted 12 patches 4 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Srivatsa Vaddagiri <quic_svaddagi@quicinc.com>, Peter Maydell <peter.maydell@linaro.org>, Richard Henderson <richard.henderson@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@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>, Eduardo Habkost <eduardo@habkost.net>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
[RFC/PATCH v2 02/12] accel: Introduce check_capability() callback
Posted by Srivatsa Vaddagiri 4 months ago
check_capability() offers a mechanism to discover accelerator capabilities.

Two capabilities are introduced at this time to discover if confidential
guest support exists and whether a confidential guest can share its
private memory with host (using appropriate hypervisor APIs).

Signed-off-by: Srivatsa Vaddagiri <quic_svaddagi@quicinc.com>
---
 include/sysemu/accel-ops.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h
index ef91fc28bb..f76d5bb8ed 100644
--- a/include/sysemu/accel-ops.h
+++ b/include/sysemu/accel-ops.h
@@ -20,6 +20,12 @@
 typedef struct AccelOpsClass AccelOpsClass;
 DECLARE_CLASS_CHECKERS(AccelOpsClass, ACCEL_OPS, TYPE_ACCEL_OPS)
 
+typedef enum {
+    CONFIDENTIAL_GUEST_SUPPORTED,
+    /* A confidential guest can share its private memory with host at runtime */
+    CONFIDENTIAL_GUEST_CAN_SHARE_MEM_WITH_HOST,
+} AccelCap;
+
 /* cpus.c operations interface */
 struct AccelOpsClass {
     /*< private >*/
@@ -47,6 +53,8 @@ struct AccelOpsClass {
     int64_t (*get_virtual_clock)(void);
     int64_t (*get_elapsed_ticks)(void);
 
+    bool (*check_capability)(AccelCap capability);
+
     /* gdbstub hooks */
     bool (*supports_guest_debug)(void);
     int (*update_guest_debug)(CPUState *cpu);
-- 
2.25.1