i386: SGX: remove deprecated member of SGXInfo

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2022-12-16 11:02:48 +01:00
parent d45f24fe75
commit fb418b51b7
4 changed files with 21 additions and 32 deletions

View file

@ -165,19 +165,6 @@ accepted incorrect commands will return an error. Users should make sure that
all arguments passed to ``device_add`` are consistent with the documented all arguments passed to ``device_add`` are consistent with the documented
property types. property types.
``query-sgx`` return value member ``section-size`` (since 7.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in return value elements with meta-type ``uint64`` is
deprecated. Use ``sections`` instead.
``query-sgx-capabilities`` return value member ``section-size`` (since 7.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in return value elements with meta-type ``uint64`` is
deprecated. Use ``sections`` instead.
System accelerators System accelerators
------------------- -------------------

View file

@ -507,6 +507,19 @@ type of array items in query-named-block-nodes.
Specify the properties for the object as top-level arguments instead. Specify the properties for the object as top-level arguments instead.
``query-sgx`` return value member ``section-size`` (removed in 8.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in the return value of ``query-sgx``
was superseded by ``sections``.
``query-sgx-capabilities`` return value member ``section-size`` (removed in 8.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in the return value of ``query-sgx-capabilities``
was superseded by ``sections``.
Human Monitor Protocol (HMP) commands Human Monitor Protocol (HMP) commands
------------------------------------- -------------------------------------

View file

@ -83,7 +83,7 @@ static uint64_t sgx_calc_section_metric(uint64_t low, uint64_t high)
((high & MAKE_64BIT_MASK(0, 20)) << 32); ((high & MAKE_64BIT_MASK(0, 20)) << 32);
} }
static SGXEPCSectionList *sgx_calc_host_epc_sections(uint64_t *size) static SGXEPCSectionList *sgx_calc_host_epc_sections(void)
{ {
SGXEPCSectionList *head = NULL, **tail = &head; SGXEPCSectionList *head = NULL, **tail = &head;
SGXEPCSection *section; SGXEPCSection *section;
@ -106,7 +106,6 @@ static SGXEPCSectionList *sgx_calc_host_epc_sections(uint64_t *size)
section = g_new0(SGXEPCSection, 1); section = g_new0(SGXEPCSection, 1);
section->node = j++; section->node = j++;
section->size = sgx_calc_section_metric(ecx, edx); section->size = sgx_calc_section_metric(ecx, edx);
*size += section->size;
QAPI_LIST_APPEND(tail, section); QAPI_LIST_APPEND(tail, section);
} }
@ -157,7 +156,6 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
{ {
SGXInfo *info = NULL; SGXInfo *info = NULL;
uint32_t eax, ebx, ecx, edx; uint32_t eax, ebx, ecx, edx;
uint64_t size = 0;
int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR); int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
if (fd < 0) { if (fd < 0) {
@ -175,8 +173,7 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
info->sgx1 = eax & (1U << 0) ? true : false; info->sgx1 = eax & (1U << 0) ? true : false;
info->sgx2 = eax & (1U << 1) ? true : false; info->sgx2 = eax & (1U << 1) ? true : false;
info->sections = sgx_calc_host_epc_sections(&size); info->sections = sgx_calc_host_epc_sections();
info->section_size = size;
close(fd); close(fd);
@ -223,14 +220,12 @@ SGXInfo *qmp_query_sgx(Error **errp)
return NULL; return NULL;
} }
SGXEPCState *sgx_epc = &pcms->sgx_epc;
info = g_new0(SGXInfo, 1); info = g_new0(SGXInfo, 1);
info->sgx = true; info->sgx = true;
info->sgx1 = true; info->sgx1 = true;
info->sgx2 = true; info->sgx2 = true;
info->flc = true; info->flc = true;
info->section_size = sgx_epc->size;
info->sections = sgx_get_epc_sections_list(); info->sections = sgx_get_epc_sections_list();
return info; return info;
@ -241,6 +236,7 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
Error *err = NULL; Error *err = NULL;
SGXEPCSectionList *section_list, *section; SGXEPCSectionList *section_list, *section;
g_autoptr(SGXInfo) info = qmp_query_sgx(&err); g_autoptr(SGXInfo) info = qmp_query_sgx(&err);
uint64_t size = 0;
if (err) { if (err) {
error_report_err(err); error_report_err(err);
@ -254,8 +250,6 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
info->sgx2 ? "enabled" : "disabled"); info->sgx2 ? "enabled" : "disabled");
monitor_printf(mon, "FLC support: %s\n", monitor_printf(mon, "FLC support: %s\n",
info->flc ? "enabled" : "disabled"); info->flc ? "enabled" : "disabled");
monitor_printf(mon, "size: %" PRIu64 "\n",
info->section_size);
section_list = info->sections; section_list = info->sections;
for (section = section_list; section; section = section->next) { for (section = section_list; section; section = section->next) {
@ -263,7 +257,10 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
section->value->node); section->value->node);
monitor_printf(mon, "size=%" PRIu64 "\n", monitor_printf(mon, "size=%" PRIu64 "\n",
section->value->size); section->value->size);
size += section->value->size;
} }
monitor_printf(mon, "total size=%" PRIu64 "\n",
size);
} }
bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)

View file

@ -329,14 +329,8 @@
# #
# @flc: true if FLC is supported # @flc: true if FLC is supported
# #
# @section-size: The EPC section size for guest
# Redundant with @sections. Just for backward compatibility.
#
# @sections: The EPC sections info for guest (Since: 7.0) # @sections: The EPC sections info for guest (Since: 7.0)
# #
# Features:
# @deprecated: Member @section-size is deprecated. Use @sections instead.
#
# Since: 6.2 # Since: 6.2
## ##
{ 'struct': 'SGXInfo', { 'struct': 'SGXInfo',
@ -344,8 +338,6 @@
'sgx1': 'bool', 'sgx1': 'bool',
'sgx2': 'bool', 'sgx2': 'bool',
'flc': 'bool', 'flc': 'bool',
'section-size': { 'type': 'uint64',
'features': [ 'deprecated' ] },
'sections': ['SGXEPCSection']}, 'sections': ['SGXEPCSection']},
'if': 'TARGET_I386' } 'if': 'TARGET_I386' }
@ -362,7 +354,7 @@
# #
# -> { "execute": "query-sgx" } # -> { "execute": "query-sgx" }
# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true, # <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
# "flc": true, "section-size" : 96468992, # "flc": true,
# "sections": [{"node": 0, "size": 67108864}, # "sections": [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} } # {"node": 1, "size": 29360128}]} }
# #
@ -382,7 +374,7 @@
# #
# -> { "execute": "query-sgx-capabilities" } # -> { "execute": "query-sgx-capabilities" }
# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true, # <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
# "flc": true, "section-size" : 96468992, # "flc": true,
# "section" : [{"node": 0, "size": 67108864}, # "section" : [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} } # {"node": 1, "size": 29360128}]} }
# #