1 /* 2 * QEMU Confidential Guest support 3 * 4 * Copyright Red Hat. 5 * 6 * Authors: 7 * David Gibson <david@gibson.dropbear.id.au> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2 or 10 * later. See the COPYING file in the top-level directory. 11 * 12 */ 13 14 #include "qemu/osdep.h" 15 16 #include "system/confidential-guest-support.h" 17 #include "qapi/error.h" 18 19 OBJECT_DEFINE_ABSTRACT_TYPE(ConfidentialGuestSupport, 20 confidential_guest_support, 21 CONFIDENTIAL_GUEST_SUPPORT, 22 OBJECT) 23 24 static bool check_support(ConfidentialGuestPlatformType platform, 25 uint16_t platform_version, uint8_t highest_vtl, 26 uint64_t shared_gpa_boundary) 27 { 28 /* Default: no support. */ 29 return false; 30 } 31 32 static int set_guest_state(hwaddr gpa, uint8_t *ptr, uint64_t len, 33 ConfidentialGuestPageType memory_type, 34 uint16_t cpu_index, Error **errp) 35 { 36 error_setg(errp, 37 "Setting confidential guest state is not supported for this platform"); 38 return -1; 39 } 40 41 static int set_guest_policy(ConfidentialGuestPolicyType policy_type, 42 uint64_t policy, 43 void *policy_data1, uint32_t policy_data1_size, 44 void *policy_data2, uint32_t policy_data2_size, 45 Error **errp) 46 { 47 error_setg(errp, 48 "Setting confidential guest policy is not supported for this platform"); 49 return -1; 50 } 51 52 static int get_mem_map_entry(int index, ConfidentialGuestMemoryMapEntry *entry, 53 Error **errp) 54 { 55 error_setg( 56 errp, 57 "Obtaining the confidential guest memory map is not supported for this platform"); 58 return -1; 59 } 60 61 static void confidential_guest_support_class_init(ObjectClass *oc, 62 const void *data) 63 { 64 ConfidentialGuestSupportClass *cgsc = CONFIDENTIAL_GUEST_SUPPORT_CLASS(oc); 65 cgsc->check_support = check_support; 66 cgsc->set_guest_state = set_guest_state; 67 cgsc->set_guest_policy = set_guest_policy; 68 cgsc->get_mem_map_entry = get_mem_map_entry; 69 } 70 71 static void confidential_guest_support_init(Object *obj) 72 { 73 } 74 75 static void confidential_guest_support_finalize(Object *obj) 76 { 77 } 78