From 5fbad160f42cc272c5fd10b81fa89b2a7f6dcf61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=89=E6=9C=97?= Date: Sat, 29 Jun 2024 00:09:45 +0800 Subject: [PATCH] Bug fix for hygon vfio based mediated hct(Patch 1051) Fix Bug: xumingkai.xmk@alibaba-inc.com guangyi.wg@alibaba-inc.com Description: An VM with multiple v-C-C-Ps will meet conflicts in index_value. The conflict comes from incorrect buf memory values. For instance, given the physical c-c-p vfio id list: 9 2 13 0 7 5 3 4 10 1 12 14 6 8 11 After c-c-p id(13)'s read(), followd ids (index_values) got incorrect value. It's needed to clean the buf memory via memset for each read(). --- ...-for-vfio-based-mediated-hct-in-index_value.patch | 12 ++++++++++++ qemu.spec | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 1055-fix-for-vfio-based-mediated-hct-in-index_value.patch diff --git a/1055-fix-for-vfio-based-mediated-hct-in-index_value.patch b/1055-fix-for-vfio-based-mediated-hct-in-index_value.patch new file mode 100644 index 0000000..4c8b133 --- /dev/null +++ b/1055-fix-for-vfio-based-mediated-hct-in-index_value.patch @@ -0,0 +1,12 @@ +diff --git a/qemu-8.2.0/hw/vfio/hct.c b/qemu-8.2.0/hw/vfio/hct.c +index fb429271b..478eaf1e6 100644 +--- qemu-8.2.0/hw/vfio/hct.c ++++ qemu-8.2.0/hw/vfio/hct.c +@@ -248,6 +248,12 @@ static int hct_get_ccp_index(HCTDevState *state) + return -errno; + } + ++ memset(buf, 0, sizeof(buf)); + ret = read(fd, buf, sizeof(buf)); + if (ret < 0) { + ret = -errno; diff --git a/qemu.spec b/qemu.spec index ce4a4b5..19189c3 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,4 +1,4 @@ -%define anolis_release 17 +%define anolis_release 19 %bcond_with check @@ -357,6 +357,7 @@ Patch1050: 1050-target-i386-Add-new-Hygon-Dharma-CPU-model.patch Patch1051: 1051-vfio-Add-vfio-based-mediated-hct-support.patch Patch1052: 1052-hw-net-virtio-net-Update-event-idx-if-guest-has-made.patch Patch1053: 1053-target-i386-csv-Release-CSV3-shared-pages-after-unma.patch +Patch1055: 1055-fix-for-vfio-based-mediated-hct-in-index_value.patch ExclusiveArch: x86_64 aarch64 loongarch64 @@ -1920,6 +1921,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Fri Aug 30 2024 Mingkai Xu - 2:8.2.0-19 +- Patch1055: 1055-fix-for-vfio-based-mediated-hct-in-index_value.patch + (Fix for vfio based mediated hct) + + * Mon Jun 20 2024 Wencheng Yang - 2:8.2.0-17 - Patch1053: 1053-target-i386-csv-Release-CSV3-shared-pages-after-unma.patch (Release CSV3 shared pages after unmapping DMA) -- Gitee