diff mbox series

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

Message ID 20240516143356.1739402-3-quic_svaddagi@quicinc.com
State New
Headers show
Series Gunyah hypervisor support | expand

Commit Message

Srivatsa Vaddagiri May 16, 2024, 2:33 p.m. UTC
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 mbox series

Patch

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);