[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 10/28] sev/i386: add command to initialize th
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH v8 10/28] sev/i386: add command to initialize the memory encryption context |
Date: |
Mon, 12 Feb 2018 16:57:13 -0200 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Mon, Feb 12, 2018 at 09:36:57AM -0600, Brijesh Singh wrote:
[...]
> +#define SEV_FW_MAX_ERROR 0x17
> +
> +static const char *const sev_fw_errlist[] = {
This requires anybody reading the code to manually count the
number of items on the array to be sure fw_error_to_str() is
safe.
What about:
#define SEV_FW_MAX_ERROR ARRAY_SIZE(sev_fw_errlist)
> + "",
> + "Platform state is invalid",
> + "Guest state is invalid",
> + "Platform configuration is invalid",
> + "Buffer too small",
> + "Platform is already owned",
> + "Certificate is invalid",
> + "Policy is not allowed",
> + "Guest is not active",
> + "Invalid address",
> + "Bad signature",
> + "Bad measurement",
> + "Asid is already owned",
> + "Invalid ASID",
> + "WBINVD is required",
> + "DF_FLUSH is required",
> + "Guest handle is invalid",
> + "Invalid command",
> + "Guest is active",
> + "Hardware error",
> + "Hardware unsafe",
> + "Feature not supported",
> + "Invalid parameter"
> +};
[...]
> +fw_error_to_str(int code)
> +{
> + if (code >= SEV_FW_MAX_ERROR) {
> + return "unknown error";
> + }
> +
> + return sev_fw_errlist[code];
> +}
> +
--
Eduardo
- [Qemu-devel] [PATCH v8 01/28] memattrs: add debug attribute, (continued)
- [Qemu-devel] [PATCH v8 01/28] memattrs: add debug attribute, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 02/28] exec: add ram_debug_ops support, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 04/28] monitor/i386: use debug APIs when accessing guest memory, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 05/28] target/i386: add memory encryption feature cpuid support, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 07/28] kvm: update kvm.h to include memory encryption ioctls, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 06/28] machine: add -memory-encryption property, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 09/28] target/i386: add Secure Encrypted Virtulization (SEV) object, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 08/28] docs: add AMD Secure Encrypted Virtualization (SEV), Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 10/28] sev/i386: add command to initialize the memory encryption context, Brijesh Singh, 2018/02/12
- Re: [Qemu-devel] [PATCH v8 10/28] sev/i386: add command to initialize the memory encryption context,
Eduardo Habkost <=
- [Qemu-devel] [PATCH v8 11/28] sev/i386: register the guest memory range which may contain encrypted data, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 12/28] kvm: introduce memory encryption APIs, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 13/28] qmp: add query-sev command, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 14/28] hmp: add 'info sev' command, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 15/28] sev/i386: add command to create launch memory encryption context, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 16/28] sev/i386: add command to encrypt guest memory region, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 17/28] target/i386: encrypt bios rom, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 19/28] sev/i386: finalize the SEV guest launch flow, Brijesh Singh, 2018/02/12