Skip to content

Commit

Permalink
hw/i386/sgx: Get rid of qemu_open_old()
Browse files Browse the repository at this point in the history
For qemu_open_old(), osdep.h said:

> Don't introduce new usage of this function, prefer the following
> qemu_open/qemu_create that take an "Error **errp".

So replace qemu_open_old() with qemu_open(). And considering the SGX
enablement description is useful, convert it into a error message hint.

Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Signed-off-by: Zhao Liu <[email protected]>
Reviewed-by: Michael Tokarev <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
trueptolemy authored and Michael Tokarev committed Jul 17, 2024
1 parent 1b1238c commit 1a48869
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hw/i386/sgx.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
{
SGXInfo *info = NULL;
uint32_t eax, ebx, ecx, edx;
Error *local_err = NULL;

int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
int fd = qemu_open("/dev/sgx_vepc", O_RDWR, &local_err);
if (fd < 0) {
error_setg(errp, "SGX is not enabled in KVM");
error_append_hint(&local_err, "SGX is not enabled in KVM");
error_propagate(errp, local_err);
return NULL;
}

Expand Down

0 comments on commit 1a48869

Please sign in to comment.