- 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)
80 lines
2.4 KiB
Diff
80 lines
2.4 KiB
Diff
From 32855e315c3050f09388f1335c0869bba065fbae Mon Sep 17 00:00:00 2001
|
|
From: yangdepei <yangdepei@hygon.cn>
|
|
Date: Fri, 27 Sep 2024 17:08:08 +0800
|
|
Subject: [PATCH] hw/vfio/hct: qemu startup terminate once error happened in
|
|
hct
|
|
|
|
Signed-off-by: yangdepei <yangdepei@hygon.cn>
|
|
---
|
|
hw/vfio/hct.c | 19 ++++++++++++++-----
|
|
1 file changed, 14 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/hw/vfio/hct.c b/hw/vfio/hct.c
|
|
index 9374e95e85..7fd3977182 100644
|
|
--- a/hw/vfio/hct.c
|
|
+++ b/hw/vfio/hct.c
|
|
@@ -136,7 +136,9 @@ static const MemoryRegionOps hct_mmio_ops = {
|
|
static void vfio_hct_detach_device(HCTDevState *state)
|
|
{
|
|
vfio_detach_device(&state->vdev);
|
|
- g_free(state->vdev.name);
|
|
+
|
|
+ if (state->vdev.name)
|
|
+ g_free(state->vdev.name);
|
|
}
|
|
|
|
static void vfio_hct_exit(PCIDevice *dev)
|
|
@@ -413,7 +415,6 @@ static int hct_data_init(HCTDevState *state)
|
|
int ret;
|
|
|
|
if (hct_data.init == 0) {
|
|
-
|
|
hct_data.hct_fd = qemu_open_old(HCT_SHARE_DEV, O_RDWR);
|
|
if (hct_data.hct_fd < 0) {
|
|
error_report("fail to open %s, errno %d.", HCT_SHARE_DEV, errno);
|
|
@@ -465,7 +466,6 @@ static void vfio_hct_realize(PCIDevice *pci_dev, Error **errp)
|
|
{
|
|
int ret;
|
|
char *mdevid;
|
|
- Error *err = NULL;
|
|
HCTDevState *state = PCI_HCT_DEV(pci_dev);
|
|
|
|
/* parsing mdev device name from startup scripts */
|
|
@@ -475,14 +475,18 @@ static void vfio_hct_realize(PCIDevice *pci_dev, Error **errp)
|
|
ret = hct_data_init(state);
|
|
if (ret < 0) {
|
|
g_free(state->vdev.name);
|
|
+ state->vdev.name = NULL;
|
|
+ error_setg(errp, "hct data init failed");
|
|
goto out;
|
|
}
|
|
|
|
ret = vfio_attach_device(state->vdev.name, &state->vdev,
|
|
- pci_device_iommu_address_space(pci_dev), &err);
|
|
+ pci_device_iommu_address_space(pci_dev), errp);
|
|
|
|
if (ret) {
|
|
- error_report("attach device failed, name = %s", state->vdev.name);
|
|
+ g_free(state->vdev.name);
|
|
+ state->vdev.name = NULL;
|
|
+ error_setg(errp, "attach device failed, name = %s", state->vdev.name);
|
|
goto data_uninit_out;
|
|
}
|
|
|
|
@@ -491,7 +495,12 @@ static void vfio_hct_realize(PCIDevice *pci_dev, Error **errp)
|
|
|
|
ret = vfio_hct_region_mmap(state);
|
|
if (ret < 0)
|
|
+ {
|
|
+ g_free(state->vdev.name);
|
|
+ state->vdev.name = NULL;
|
|
+ error_setg(errp, "region mmap failed, name = %s", state->vdev.name);
|
|
goto detach_device_out;
|
|
+ }
|
|
|
|
return;
|
|
|
|
--
|
|
2.41.0.windows.1
|
|
|