qemu/target-i386-sev-Fix-incompatibility-between-SEV-and-.patch
Jiabo Feng f2ed4aa869 QEMU update to version 8.2.0-25:
- hw/arm/virt:Keep Guest L1 cache type consistent with KVM
- cvm : Add support for TEE-based national encryption acceleration.
- Add virtCCA Coda annotation Adjust the position of the security device
- target/i386: sev: Add support for reuse ASID for different CSV guests
- target/i386: sev: Fix incompatibility between SEV and CSV on the GET_ID API
- hw/cxl: Ensure there is enough data for the header in cmd_ccls_set_lsa()
- hw/pci: Add parenthesis to PCI_BUILD_BDF macro
- hw/audio/hda: free timer on exit
- meson.build: Remove ncurses workaround for OpenBSD
- ui/console-vc: Silence warning about sprintf() on OpenBSD
- ui: remove break after g_assert_not_reached()
- s390x/sclp: Simplify get_sclp_device()
- hw/vfio/hct: qemu startup terminate once error happened in hct
- hw/vfio/hct: fix ccp_index error caused by uninitialized buf
- hw/vfio/hct: update support ccp count to 48.
- hw/vfio: add device hct based on vfio.

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
(cherry picked from commit 702a9cc4e262a50f7aa6f7c9549fbc13d4cd0770)
2024-11-30 11:31:31 +08:00

37 lines
1.3 KiB
Diff

From c357946fa7c1d45a09b40214b5113f689bf7bbd0 Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Fri, 1 Mar 2024 14:12:44 +0800
Subject: [PATCH] target/i386: sev: Fix incompatibility between SEV and CSV on
the GET_ID API
If the length of GET_ID request is too small, Hygon CSV will return
SEV_RET_INVALID_PARAM. This return code doesn't comply with SEV API
Spec.
Hygon will consider to fix the compitibility issue of return value
of the GET_ID API, so also check whether the return value is
SEV_RET_INVALID_LEN on Hygon CPUs.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
target/i386/sev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 2c6aecd1a3..04888bc3a8 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -589,7 +589,8 @@ static int sev_get_cpu0_id(int fd, guchar **id, size_t *id_len, Error **errp)
/* query the ID length */
r = sev_platform_ioctl(fd, SEV_GET_ID2, &get_id2, &err);
- if (r < 0 && err != SEV_RET_INVALID_LEN) {
+ if (r < 0 && err != SEV_RET_INVALID_LEN &&
+ !(is_hygon_cpu() && err == SEV_RET_INVALID_PARAM)) {
error_setg(errp, "SEV: Failed to get ID ret=%d fw_err=%d (%s)",
r, err, fw_error_to_str(err));
return 1;
--
2.41.0.windows.1