Skip to contentSkip to conversation

pci, vhost, virtio, iommu: features, fixes, cleanups

GIT PULL Applied Michael S. Tsirkin 7 participants 117 messages Jun 14 – Jun 24 1 message not in the archive Page 2 of 2

Subsystems (3)
lore
Share & tools
lore
#105 lore raw

[PULL 045/106] hw/virtio/virtio-bus: refactor virtio_bus_set_host_notifier()

In reply to Michael S. Tsirkin

From: Vladimir Sementsov-Ogievskiy <[email protected]>

The logic kept as is. Refactor to simplify further changes.

Message-Id: <[email protected]>

---
 hw/virtio/virtio-bus.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
hw/virtio/virtio-bus.c +8 -10
index cef944e015..9b545acda3 100644
@@ -298,20 +298,18 @@ int virtio_bus_set_host_notifier(VirtioBusState *bus, int n, bool assign)
                          __func__, strerror(-r), r);
             return r;
         }
-        r = k->ioeventfd_assign(proxy, notifier, n, true);
-        if (r < 0) {
-            error_report("%s: unable to assign ioeventfd: %d", __func__, r);
-            virtio_bus_cleanup_host_notifier(bus, n);
-        }
-    } else {
-        k->ioeventfd_assign(proxy, notifier, n, false);
     }
 
-    if (r == 0) {
-        virtio_queue_set_host_notifier_enabled(vq, assign);
+    r = k->ioeventfd_assign(proxy, notifier, n, assign);
+    if (r < 0 && assign) {
+        error_report("%s: unable to assign ioeventfd: %d", __func__, r);
+        virtio_bus_cleanup_host_notifier(bus, n);
+        return r;
     }
 
-    return r;
+    virtio_queue_set_host_notifier_enabled(vq, assign);
+
+    return 0;
 }
 
 void virtio_bus_cleanup_host_notifier(VirtioBusState *bus, int n)
Signature · 1 line
MST
#106 lore raw

[PULL 044/106] vhost: vhost_dev_init(): simplify features initialization

In reply to Michael S. Tsirkin

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Drop extra variable and extra function parameter passing, initialize dev._features directly.

Message-Id: <[email protected]>

---
 hw/virtio/vhost.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
hw/virtio/vhost.c +5 -9
index 55ce7ae977..93c6a5f5e9 100644
@@ -1560,18 +1560,17 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
     }
 }
 
-static int vhost_dev_get_features(struct vhost_dev *hdev,
-                                  uint64_t *features)
+static int vhost_dev_init_features(struct vhost_dev *hdev)
 {
     uint64_t features64;
     int r;
 
     if (hdev->vhost_ops->vhost_get_features_ex) {
-        return hdev->vhost_ops->vhost_get_features_ex(hdev, features);
+        return hdev->vhost_ops->vhost_get_features_ex(hdev, hdev->_features_ex);
     }
 
     r = hdev->vhost_ops->vhost_get_features(hdev, &features64);
-    virtio_features_from_u64(features, features64);
+    virtio_features_from_u64(hdev->_features_ex, features64);
     return r;
 }
 
@@ -1579,7 +1578,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
                    VhostBackendType backend_type, uint32_t busyloop_timeout,
                    Error **errp)
 {
-    uint64_t features[VIRTIO_FEATURES_NU64S];
     unsigned int used, reserved, limit;
     int i, r, n_initialized_vqs = 0;
 
@@ -1600,9 +1598,9 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
         goto fail;
     }
 
-    r = vhost_dev_get_features(hdev, features);
+    r = vhost_dev_init_features(hdev);
     if (r < 0) {
-        error_setg_errno(errp, -r, "vhost_get_features failed");
+        error_setg_errno(errp, -r, "vhost_init_features failed");
         goto fail;
     }
 
@@ -1628,8 +1626,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
         }
     }
 
-    virtio_features_copy(hdev->_features_ex, features);
-
     hdev->memory_listener = (MemoryListener) {
         .name = "vhost",
         .begin = vhost_begin,
Signature · 1 line
MST
#107 lore raw

[PULL 105/106] tests/qtest: add 8-byte MMIO access sweep for intel-iommu

In reply to Michael S. Tsirkin

From: Junjie Cao <[email protected]>

Sweep every 4-byte-aligned offset in the VT-d MMIO register space with 8-byte reads and writes to verify that no register handler aborts on an oversized access.

Message-Id: <[email protected]>

---
 tests/qtest/intel-iommu-test.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
tests/qtest/intel-iommu-test.c +30 -0
index 30ee6524df..ef6e6eb8b6 100644
@@ -17,11 +17,39 @@
 #define ECAP_STAGE_1_FIXED1   (VTD_ECAP_QI |  VTD_ECAP_IR | VTD_ECAP_IRO | \
                               VTD_ECAP_MHMV | VTD_ECAP_SMTS | VTD_ECAP_FSTS)
 
+static inline uint32_t vtd_reg_readl(QTestState *s, uint64_t offset)
+{
+    return qtest_readl(s, Q35_HOST_BRIDGE_IOMMU_ADDR + offset);
+}
+
 static inline uint64_t vtd_reg_readq(QTestState *s, uint64_t offset)
 {
     return qtest_readq(s, Q35_HOST_BRIDGE_IOMMU_ADDR + offset);
 }
 
+static inline void vtd_reg_writeq(QTestState *s, uint64_t offset,
+                                  uint64_t value)
+{
+    qtest_writeq(s, Q35_HOST_BRIDGE_IOMMU_ADDR + offset, value);
+}
+
+static void test_intel_iommu_8byte_access(void)
+{
+    QTestState *s;
+    uint64_t off;
+
+    s = qtest_init("-M q35 -device intel-iommu");
+
+    for (off = 0; off < DMAR_REG_SIZE; off += 4) {
+        vtd_reg_readq(s, off);
+        vtd_reg_writeq(s, off, 0);
+    }
+
+    g_assert_cmpuint(vtd_reg_readl(s, DMAR_VER_REG), !=, 0);
+
+    qtest_quit(s);
+}
+
 static void test_intel_iommu_stage_1(void)
 {
     uint8_t init_csr[DMAR_REG_SIZE];     /* register values */
@@ -58,6 +86,8 @@ static void test_intel_iommu_stage_1(void)
 int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/q35/intel-iommu/8byte-access",
+                   test_intel_iommu_8byte_access);
     qtest_add_func("/q35/intel-iommu/stage-1", test_intel_iommu_stage_1);
 
     return g_test_run();
Signature · 1 line
MST
#108 lore raw

[PULL 056/106] vhost: rename vring pointer fields to reflect user addresses

In reply to Michael S. Tsirkin

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Rename vq->desc/avail/used to vq->desc_user/avail_user/used_user to clearly indicate these fields contain user space addresses, not physical addresses.

Based-on: <[email protected]>

Message-Id: <[email protected]>

---
 hw/virtio/vhost.c         | 37 +++++++++++++++++++------------------
 include/hw/virtio/vhost.h |  6 +++---
 2 files changed, 22 insertions(+), 21 deletions(-)
hw/virtio/vhost.c +19 -18
index 6bb6b07e19..e3d452a763 100644
@@ -489,11 +489,11 @@ static void vhost_vrings_unmap(struct vhost_dev *dev,
         return;
     }
 
-    vhost_memory_unmap(dev, &vq->used, vq->used_size, touched,
+    vhost_memory_unmap(dev, &vq->used_user, vq->used_size, touched,
                        touched ? vq->used_size : 0);
-    vhost_memory_unmap(dev, &vq->avail, vq->avail_size, 0,
+    vhost_memory_unmap(dev, &vq->avail_user, vq->avail_size, 0,
                        touched ? vq->avail_size : 0);
-    vhost_memory_unmap(dev, &vq->desc, vq->desc_size, 0,
+    vhost_memory_unmap(dev, &vq->desc_user, vq->desc_size, 0,
                        touched ? vq->desc_size : 0);
 }
 
@@ -504,13 +504,13 @@ static int vhost_vrings_map(struct vhost_dev *dev,
 {
     vq->desc_size = virtio_queue_get_desc_size(vdev, idx);
     vq->desc_phys = virtio_queue_get_desc_addr(vdev, idx);
-    vq->desc = NULL;
+    vq->desc_user = NULL;
     vq->avail_size = virtio_queue_get_avail_size(vdev, idx);
     vq->avail_phys = virtio_queue_get_avail_addr(vdev, idx);
-    vq->avail = NULL;
+    vq->avail_user = NULL;
     vq->used_size = virtio_queue_get_used_size(vdev, idx);
     vq->used_phys = virtio_queue_get_used_addr(vdev, idx);
-    vq->used = NULL;
+    vq->used_user = NULL;
 
     if (vq->desc_phys == 0) {
         /* Queue might not be ready for start */
@@ -521,16 +521,17 @@ static int vhost_vrings_map(struct vhost_dev *dev,
         return 1;
     }
 
-    vq->desc = vhost_memory_map(dev, vq->desc_phys, vq->desc_size, false);
-    if (!vq->desc) {
+    vq->desc_user = vhost_memory_map(dev, vq->desc_phys, vq->desc_size, false);
+    if (!vq->desc_user) {
         goto fail;
     }
-    vq->avail = vhost_memory_map(dev, vq->avail_phys, vq->avail_size, false);
-    if (!vq->avail) {
+    vq->avail_user = vhost_memory_map(dev, vq->avail_phys, vq->avail_size,
+                                      false);
+    if (!vq->avail_user) {
         goto fail;
     }
-    vq->used = vhost_memory_map(dev, vq->used_phys, vq->used_size, true);
-    if (!vq->used) {
+    vq->used_user = vhost_memory_map(dev, vq->used_phys, vq->used_size, true);
+    if (!vq->used_user) {
         goto fail;
     }
 
@@ -594,7 +595,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
 
         j = 0;
         r = vhost_verify_ring_part_mapping(
-                vq->desc, vq->desc_phys, vq->desc_size,
+                vq->desc_user, vq->desc_phys, vq->desc_size,
                 reg_hva, reg_gpa, reg_size);
         if (r) {
             break;
@@ -602,7 +603,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
 
         j++;
         r = vhost_verify_ring_part_mapping(
-                vq->avail, vq->avail_phys, vq->avail_size,
+                vq->avail_user, vq->avail_phys, vq->avail_size,
                 reg_hva, reg_gpa, reg_size);
         if (r) {
             break;
@@ -610,7 +611,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
 
         j++;
         r = vhost_verify_ring_part_mapping(
-                vq->used, vq->used_phys, vq->used_size,
+                vq->used_user, vq->used_phys, vq->used_size,
                 reg_hva, reg_gpa, reg_size);
         if (r) {
             break;
@@ -1106,9 +1107,9 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
         addr.avail_user_addr = (uint64_t)(unsigned long)vq->avail_phys;
         addr.used_user_addr = (uint64_t)(unsigned long)vq->used_phys;
     } else {
-        addr.desc_user_addr = (uint64_t)(unsigned long)vq->desc;
-        addr.avail_user_addr = (uint64_t)(unsigned long)vq->avail;
-        addr.used_user_addr = (uint64_t)(unsigned long)vq->used;
+        addr.desc_user_addr = (uint64_t)(unsigned long)vq->desc_user;
+        addr.avail_user_addr = (uint64_t)(unsigned long)vq->avail_user;
+        addr.used_user_addr = (uint64_t)(unsigned long)vq->used_user;
     }
     addr.index = idx;
     addr.log_guest_addr = vq->used_phys;
include/hw/virtio/vhost.h +3 -3
index b292e9f0fe..684bafcaad 100644
@@ -24,9 +24,9 @@ struct vhost_inflight {
 struct vhost_virtqueue {
     int kick;
     int call;
-    void *desc;
-    void *avail;
-    void *used;
+    void *desc_user;
+    void *avail_user;
+    void *used_user;
     int num;
     unsigned long long desc_phys;
     unsigned desc_size;
Signature · 1 line
MST
#109 lore raw

[PULL 041/106] vhost: final refactoring of vhost vrings map/unmap

In reply to Michael S. Tsirkin

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Introduce helper functions vhost_vrings_map() and
vhost_vrings_unmap() and use them.

Message-Id: <[email protected]>

---
 hw/virtio/vhost.c | 89 +++++++++++++++++++++++++++++------------------
 1 file changed, 55 insertions(+), 34 deletions(-)
hw/virtio/vhost.c +55 -34
index a3bf7e5a9b..c71b18cfc8 100644
@@ -489,6 +489,56 @@ static void vhost_memory_unmap(struct vhost_dev *dev, void **buffer,
     *buffer = NULL;
 }
 
+static void vhost_vrings_unmap(struct vhost_dev *dev,
+                               struct vhost_virtqueue *vq, bool touched)
+{
+    vhost_memory_unmap(dev, &vq->used, vq->used_size, touched,
+                       touched ? vq->used_size : 0);
+    vhost_memory_unmap(dev, &vq->avail, vq->avail_size, 0,
+                       touched ? vq->avail_size : 0);
+    vhost_memory_unmap(dev, &vq->desc, vq->desc_size, 0,
+                       touched ? vq->desc_size : 0);
+}
+
+static int vhost_vrings_map(struct vhost_dev *dev,
+                            struct VirtIODevice *vdev,
+                            struct vhost_virtqueue *vq,
+                            unsigned idx)
+{
+    vq->desc_size = virtio_queue_get_desc_size(vdev, idx);
+    vq->desc_phys = virtio_queue_get_desc_addr(vdev, idx);
+    vq->desc = NULL;
+    vq->avail_size = virtio_queue_get_avail_size(vdev, idx);
+    vq->avail_phys = virtio_queue_get_avail_addr(vdev, idx);
+    vq->avail = NULL;
+    vq->used_size = virtio_queue_get_used_size(vdev, idx);
+    vq->used_phys = virtio_queue_get_used_addr(vdev, idx);
+    vq->used = NULL;
+
+    if (vq->desc_phys == 0) {
+        /* Queue might not be ready for start */
+        return 0;
+    }
+    vq->desc = vhost_memory_map(dev, vq->desc_phys, vq->desc_size, false);
+    if (!vq->desc) {
+        goto fail;
+    }
+    vq->avail = vhost_memory_map(dev, vq->avail_phys, vq->avail_size, false);
+    if (!vq->avail) {
+        goto fail;
+    }
+    vq->used = vhost_memory_map(dev, vq->used_phys, vq->used_size, true);
+    if (!vq->used) {
+        goto fail;
+    }
+
+    return 1;
+
+fail:
+    vhost_vrings_unmap(dev, vq, false);
+    return -ENOMEM;
+}
+
 static int vhost_verify_ring_part_mapping(void *ring_hva,
                                           uint64_t ring_gpa,
                                           uint64_t ring_size,
@@ -1287,34 +1337,9 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
     };
     struct VirtQueue *vvq = virtio_get_queue(vdev, idx);
 
-    vq->desc_size = virtio_queue_get_desc_size(vdev, idx);
-    vq->desc_phys = virtio_queue_get_desc_addr(vdev, idx);
-    vq->desc = NULL;
-    vq->avail_size = virtio_queue_get_avail_size(vdev, idx);
-    vq->avail_phys = virtio_queue_get_avail_addr(vdev, idx);
-    vq->avail = NULL;
-    vq->used_size = virtio_queue_get_used_size(vdev, idx);
-    vq->used_phys = virtio_queue_get_used_addr(vdev, idx);
-    vq->used = NULL;
-
-    if (vq->desc_phys == 0) {
-        /* Queue might not be ready for start */
-        return 0;
-    }
-    vq->desc = vhost_memory_map(dev, vq->desc_phys, vq->desc_size, false);
-    if (!vq->desc) {
-        r = -ENOMEM;
-        goto fail;
-    }
-    vq->avail = vhost_memory_map(dev, vq->avail_phys, vq->avail_size, false);
-    if (!vq->avail) {
-        r = -ENOMEM;
-        goto fail;
-    }
-    vq->used = vhost_memory_map(dev, vq->used_phys, vq->used_size, true);
-    if (!vq->used) {
-        r = -ENOMEM;
-        goto fail;
+    r = vhost_vrings_map(dev, vdev, vq, idx);
+    if (r <= 0) {
+        return r;
     }
 
     vq->num = state.num = virtio_queue_get_num(vdev, idx);
@@ -1375,9 +1400,7 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
     return 0;
 
 fail:
-    vhost_memory_unmap(dev, &vq->used, vq->used_size, 0, 0);
-    vhost_memory_unmap(dev, &vq->avail, vq->avail_size, 0, 0);
-    vhost_memory_unmap(dev, &vq->desc, vq->desc_size, 0, 0);
+    vhost_vrings_unmap(dev, vq, false);
     return r;
 }
 
@@ -1424,9 +1447,7 @@ static int do_vhost_virtqueue_stop(struct vhost_dev *dev,
                                                 vhost_vq_index);
     }
 
-    vhost_memory_unmap(dev, &vq->used, vq->used_size, 1, vq->used_size);
-    vhost_memory_unmap(dev, &vq->avail, vq->avail_size, 0, vq->avail_size);
-    vhost_memory_unmap(dev, &vq->desc, vq->desc_size, 0, vq->desc_size);
+    vhost_vrings_unmap(dev, vq, true);
     return r;
 }
 
Signature · 1 line
MST
#110 lore raw

[PULL 063/106] amd_iommu: Follow root pointer before page walk and use 1-based levels

In reply to Michael S. Tsirkin

From: Alejandro Jimenez <[email protected]>

DTE[Mode] and PTE NextLevel encode page table levels as 1-based values, but fetch_pte() currently uses a 0-based level counter, making the logic harder to follow and requiring conversions between DTE mode and level.

Switch the page table walk logic to use 1-based level accounting in fetch_pte() and the relevant macro helpers. To further simplify the page walking loop, split the root page table access from the walk i.e. rework fetch_pte() to follow the DTE Page Table Root Pointer and retrieve the top level pagetable entry before entering the loop, then iterate only over the PDE/PTE entries.

The reworked algorithm fixes a page walk bug where the page size was calculated for the next level before checking if the current PTE was already a leaf/hugepage. That caused hugepage mappings to be reported as 4K pages, leading to performance degradation and failures in some setups.

Message-Id: <[email protected]>

---
 hw/i386/amd_iommu.c | 134 ++++++++++++++++++++++++++++++--------------
 hw/i386/amd_iommu.h |  11 ++--
 2 files changed, 98 insertions(+), 47 deletions(-)
hw/i386/amd_iommu.c +93 -41
index 5d6a405263..bc083d0073 100644
@@ -648,6 +648,52 @@ static uint64_t large_pte_page_size(uint64_t pte)
     return PTE_LARGE_PAGE_SIZE(pte);
 }
 
+/*
+ * Validate DTE fields and extract permissions and top level data required to
+ * initiate the page table walk.
+ *
+ * On success, returns 0 and stores:
+ *   - top_level: highest page-table level encoded in DTE[Mode]
+ *   - dte_perms: effective permissions from the DTE
+ *
+ * On failure, returns -AMDVI_FR_PT_ROOT_INV. This includes cases where:
+ *   - DTE permissions disallow read AND write
+ *   - DTE[Mode] is invalid for translation
+ *   - IOVA exceeds the address width supported by DTE[Mode]
+ * In all such cases a page walk must be aborted.
+ */
+static uint64_t amdvi_get_top_pt_level_and_perms(hwaddr address, uint64_t dte,
+                                                 uint8_t *top_level,
+                                                 IOMMUAccessFlags *dte_perms)
+{
+    *dte_perms = amdvi_get_perms(dte);
+    if (*dte_perms == IOMMU_NONE) {
+        return -AMDVI_FR_PT_ROOT_INV;
+    }
+
+    /* Verifying a valid mode is encoded in DTE */
+    *top_level = get_pte_translation_mode(dte);
+
+    /*
+     * Page Table Root pointer is only valid for GPA->SPA translation on
+     * supported modes.
+     */
+    if (*top_level == 0 || *top_level > 6) {
+        return -AMDVI_FR_PT_ROOT_INV;
+    }
+
+    /*
+     * If IOVA is larger than the max supported by the highest pgtable level,
+     * there is nothing to do.
+     */
+    if (address > PT_LEVEL_MAX_ADDR(*top_level)) {
+        /* IOVA too large for the current DTE */
+        return -AMDVI_FR_PT_ROOT_INV;
+    }
+
+    return 0;
+}
+
 /*
  * Helper function to fetch a PTE using AMD v1 pgtable format.
  * On successful page walk, returns 0 and pte parameter points to a valid PTE.
@@ -662,40 +708,49 @@ static uint64_t large_pte_page_size(uint64_t pte)
 static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
                           uint64_t *pte, hwaddr *page_size)
 {
-    IOMMUAccessFlags perms = amdvi_get_perms(dte);
-
-    uint8_t level, mode;
     uint64_t pte_addr;
+    uint8_t pt_level, next_pt_level;
+    IOMMUAccessFlags perms;
+    int ret;
 
-    *pte = dte;
     *page_size = 0;
 
-    if (perms == IOMMU_NONE) {
+    /*
+     * Verify the DTE is properly configured before page walk, and extract
+     * top pagetable level and permissions.
+     */
+    ret = amdvi_get_top_pt_level_and_perms(address, dte, &pt_level, &perms);
+    if (ret < 0) {
+        return ret;
+    }
+
+    /*
+     * Retrieve the top pagetable entry by following the DTE Page Table Root
+     * Pointer and indexing the top level table using the IOVA from the request.
+     */
+    pte_addr = NEXT_PTE_ADDR(dte, pt_level, address);
+    *pte = amdvi_get_pte_entry(as->iommu_state, pte_addr, as->devfn);
+
+    if (*pte == (uint64_t)-1) {
+        /*
+         * A returned PTE of -1 here indicates a failure to read the top level
+         * page table from guest memory. A page walk is not possible and page
+         * size must be returned as 0.
+         */
         return -AMDVI_FR_PT_ROOT_INV;
     }
 
     /*
-     * The Linux kernel driver initializes the default mode to 3, corresponding
-     * to a 39-bit GPA space, where each entry in the pagetable translates to a
-     * 1GB (2^30) page size.
+     * Calculate page size for the top level page table entry.
+     * This ensures correct results for a single level Page Table setup.
      */
-    level = mode = get_pte_translation_mode(dte);
-    assert(mode > 0 && mode < 7);
+    *page_size = PTE_LEVEL_PAGE_SIZE(pt_level);
 
     /*
-     * If IOVA is larger than the max supported by the current pgtable level,
-     * there is nothing to do.
+     * The root page table entry and its level have been determined. Begin the
+     * page walk.
      */
-    if (address > PT_LEVEL_MAX_ADDR(mode - 1)) {
-        /* IOVA too large for the current DTE */
-        return -AMDVI_FR_PT_ROOT_INV;
-    }
-
-    do {
-        level -= 1;
-
-        /* Update the page_size */
-        *page_size = PTE_LEVEL_PAGE_SIZE(level);
+    while (pt_level > 0) {
 
         /* Permission bits are ANDed at every level, including the DTE */
         perms &= amdvi_get_perms(*pte);
@@ -708,37 +763,34 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
             return 0;
         }
 
+        next_pt_level = PTE_NEXT_LEVEL(*pte);
+
         /* Large or Leaf PTE found */
-        if (PTE_NEXT_LEVEL(*pte) == 7 || PTE_NEXT_LEVEL(*pte) == 0) {
+        if (next_pt_level == 0 || next_pt_level == 7) {
             /* Leaf PTE found */
             break;
         }
 
+        pt_level = next_pt_level;
+
         /*
-         * Index the pgtable using the IOVA bits corresponding to current level
-         * and walk down to the lower level.
+         * The current entry is a Page Directory Entry. Descend to the lower
+         * page table level encoded in current pte, and index the new table
+         * using the appropriate IOVA bits to retrieve the new entry.
          */
-        pte_addr = NEXT_PTE_ADDR(*pte, level, address);
+        *page_size = PTE_LEVEL_PAGE_SIZE(pt_level);
+
+        pte_addr = NEXT_PTE_ADDR(*pte, pt_level, address);
         *pte = amdvi_get_pte_entry(as->iommu_state, pte_addr, as->devfn);
 
         if (*pte == (uint64_t)-1) {
-            /*
-             * A returned PTE of -1 indicates a failure to read the page table
-             * entry from guest memory.
-             */
-            if (level == mode - 1) {
-                /* Failure to retrieve the Page Table from Root Pointer */
-                *page_size = 0;
-                return -AMDVI_FR_PT_ROOT_INV;
-            } else {
-                /* Failure to read PTE. Page walk skips a page_size chunk */
-                return -AMDVI_FR_PT_ENTRY_INV;
-            }
+            /* Failure to read PTE. Page walk skips a page_size chunk */
+            return -AMDVI_FR_PT_ENTRY_INV;
         }
-    } while (level > 0);
+    }
+
+    assert(PTE_NEXT_LEVEL(*pte) == 0 || PTE_NEXT_LEVEL(*pte) == 7);
 
-    assert(PTE_NEXT_LEVEL(*pte) == 0 || PTE_NEXT_LEVEL(*pte) == 7 ||
-           level == 0);
     /*
      * Page walk ends when Next Level field on PTE shows that either a leaf PTE
      * or a series of large PTEs have been reached. In the latter case, even if
hw/i386/amd_iommu.h +5 -6
index 302ccca512..7af3c742b7 100644
@@ -186,17 +186,16 @@
 
 #define IOMMU_PTE_PRESENT(pte)          ((pte) & AMDVI_PTE_PR)
 
-/* Using level=0 for leaf PTE at 4K page size */
-#define PT_LEVEL_SHIFT(level)           (12 + ((level) * 9))
+/* Using level=1 for leaf PTE at 4K page size */
+#define PT_LEVEL_SHIFT(level)           (12 + (((level) - 1) * 9))
 
 /* Return IOVA bit group used to index the Page Table at specific level */
 #define PT_LEVEL_INDEX(level, iova)     (((iova) >> PT_LEVEL_SHIFT(level)) & \
                                         GENMASK64(8, 0))
 
-/* Return the max address for a specified level i.e. max_oaddr */
-#define PT_LEVEL_MAX_ADDR(x)    (((x) < 5) ? \
-                                ((1ULL << PT_LEVEL_SHIFT((x + 1))) - 1) : \
-                                (~(0ULL)))
+/* Return the maximum output address for a specified page table level */
+#define PT_LEVEL_MAX_ADDR(level)    (((level) > 5) ? (~(0ULL)) : \
+                                    ((1ULL << PT_LEVEL_SHIFT((level) + 1)) - 1))
 
 /* Extract the NextLevel field from PTE/PDE */
 #define PTE_NEXT_LEVEL(pte)     (((pte) & AMDVI_PTE_NEXT_LEVEL_MASK) >> 9)
Signature · 1 line
MST
#113 lore raw

[PULL 067/106] ppc/pnv_phb3: Error out on invalid config access

In reply to Michael S. Tsirkin

From: Aditya Gupta <[email protected]>

PHB in Power8 supports 8 byte registers, and hence the ops structure allows accessing of 8 bytes in 'pnv_phb3_reg_ops'

Both 'pnv_phb3_reg_read' & 'pnv_phb3_reg_write' pass the arguments as is to 'pnv_phb3_config_{read,write}', if offset is PHB_CONFIG_DATA.

This when called with size as 8, causes following assert failure in 'pci_host_config_read_common' & 'pci_host_config_write_common':

    assert(len <= 4);

Validate that size is <=4, before jumping to pci_host_config_{read,write}_common

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3334

Fixes 9ae1329ee2fe ("ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge")

Message-Id: <[email protected]>

---
 hw/pci-host/pnv_phb3.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/pci-host/pnv_phb3.c +10 -0
index d6ab515337..4ffdb4ce31 100644
@@ -475,6 +475,11 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned size)
 
     /* Special case configuration data */
     if ((off & 0xfffc) == PHB_CONFIG_DATA) {
+        if (size > 4) {
+            phb3_error(phb, "Invalid config access, offset: 0x%"PRIx64" size: %d",
+                      off, size);
+            return;
+        }
         pnv_phb3_config_write(phb, off & 0x3, size, val);
         return;
     }
@@ -597,6 +602,11 @@ uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, unsigned size)
     uint64_t val;
 
     if ((off & 0xfffc) == PHB_CONFIG_DATA) {
+        if (size > 4) {
+            phb3_error(phb, "Invalid config access, offset: 0x%"PRIx64" size: %d",
+                      off, size);
+            return ~0ull;
+        }
         return pnv_phb3_config_read(phb, off & 0x3, size);
     }
 
Signature · 1 line
MST
#114 lore raw

[PULL 039/106] vhost: move vrings mapping to the top of vhost_virtqueue_start()

In reply to Michael S. Tsirkin

From: Vladimir Sementsov-Ogievskiy <[email protected]>

This simplifies further refactoring and final introduction of vhost backend live migration.

Message-Id: <[email protected]>

---
 hw/virtio/vhost.c | 45 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 23 deletions(-)
hw/virtio/vhost.c +22 -23
index f43e563f0d..d5bafbcc4b 100644
@@ -1303,29 +1303,6 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
         return 0;
     }
 
-    vq->num = state.num = virtio_queue_get_num(vdev, idx);
-    r = dev->vhost_ops->vhost_set_vring_num(dev, &state);
-    if (r) {
-        VHOST_OPS_DEBUG(r, "vhost_set_vring_num failed");
-        return r;
-    }
-
-    state.num = virtio_queue_get_last_avail_idx(vdev, idx);
-    r = dev->vhost_ops->vhost_set_vring_base(dev, &state);
-    if (r) {
-        VHOST_OPS_DEBUG(r, "vhost_set_vring_base failed");
-        return r;
-    }
-
-    if (vhost_needs_vring_endian(vdev)) {
-        r = vhost_virtqueue_set_vring_endian_legacy(dev,
-                                                    virtio_vdev_is_big_endian(vdev),
-                                                    vhost_vq_index);
-        if (r) {
-            return r;
-        }
-    }
-
     l = vq->desc_size;
     vq->desc = vhost_memory_map(dev, vq->desc_phys, l, false);
     if (!vq->desc) {
@@ -1347,6 +1324,28 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
         goto fail;
     }
 
+    vq->num = state.num = virtio_queue_get_num(vdev, idx);
+    r = dev->vhost_ops->vhost_set_vring_num(dev, &state);
+    if (r) {
+        VHOST_OPS_DEBUG(r, "vhost_set_vring_num failed");
+        goto fail;
+    }
+
+    state.num = virtio_queue_get_last_avail_idx(vdev, idx);
+    r = dev->vhost_ops->vhost_set_vring_base(dev, &state);
+    if (r) {
+        VHOST_OPS_DEBUG(r, "vhost_set_vring_base failed");
+        goto fail;
+    }
+
+    if (vhost_needs_vring_endian(vdev)) {
+        r = vhost_virtqueue_set_vring_endian_legacy(
+            dev, virtio_vdev_is_big_endian(vdev), vhost_vq_index);
+        if (r) {
+            goto fail;
+        }
+    }
+
     r = vhost_virtqueue_set_addr(dev, vq, vhost_vq_index, dev->log_enabled);
     if (r < 0) {
         goto fail;
Signature · 1 line
MST
#115 lore raw
In reply to Michael S. Tsirkin
Quoted 3 lines · Michael S. Tsirkin

Resolved a bunch of conflicts.
If you see anything wrong here, pls holler.

Hi Michael,
The check for mangled mailing list author emails is failing. Please git commit --amend --author=... with their real email and resend your pull request:

Alireza Sanaee via qemu development (2):
hw/cxl: Allow cxl_cfmws_find_device() to filter on whether
interleaved paths are accepted
hw/cxl: Add a performant (and correct) path for the non interleaved cases
ERROR: pull request includes commits attributed to list

Thanks!

Stefan

Quoted 354 lines

The following changes since commit f5a2438405d4ae8b62de7c9b39fac0b2155ee544:

Merge tag 'pull-qapi-2026-05-21' of https://repo.or.cz/qemu/armbru into staging (2026-05-21 09:00:22 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 31dbba011d0f3a21432d0629fae0b4885f2eed25:

hw/scsi/vhost-scsi: fix build with older kernel headers (2026-06-03 08:36:42 -0400)

----------------------------------------------------------------
pci, vhost, virtio, iommu: features, fixes, cleanups

intel_iommu:
PASID support for passthrough
some properties renamed
virtio-rtc:
new device
acpi:
watchdog (x86 q35)
COM irqs are now shared
vhost-user:
vhost-user passes GPA not HVA now
vhost SHMEM_MAP/UNMAP support
vhost-vdpa:
svq IN_ORDER support
amd_iommu:
IOMMU XT interrupt support
command buffer fixes
cxl:
PPR support
performant path for non-interleaved cases
vhost-scsi:
build fix for older kernel headers
fixes, cleanups all over the place

----------------------------------------------------------------
Aditya Gupta (2):
ppc/pnv_phb3: Error out on invalid config access hw/pci: Replace assert with bounds check and return

Albert Esteve (7):
vhost-user: Add VirtIO Shared Memory map request vhost_user.rst: Align VhostUserMsg excerpt members vhost_user.rst: Add SHMEM_MAP/_UNMAP to spec
vhost_user: Add frontend get_shmem_config command vhost_user.rst: Add GET_SHMEM_CONFIG message
qmp: add shmem feature map
vhost-user-device: Add shared memory BAR

Alejandro Jimenez (3):
amd_iommu: Update command buffer head ptr in MMIO region after wraparound
amd_iommu: Follow root pointer before page walk and use 1-based levels
amd_iommu: Reject non-decreasing NextLevel in fetch_pte()

Alexandr Moshkov (1):
vhost-user.rst: fix typo

Alexey Gerasimenko (1):
q35: Fix incorrect values for PCIEXBAR masks

Alireza Sanaee via qemu development (2):
hw/cxl: Allow cxl_cfmws_find_device() to filter on whether interleaved paths are accepted hw/cxl: Add a performant (and correct) path for the non interleaved cases

Costas Argyris (1):
tests/qtest: Add amd-iommu command buffer head wrap test

Eugenio Pérez (8):
net/vhost-vdpa: enable vqs before DRIVER_OK if no cvq
virtio: Allow to fill a whole virtqueue in order
vhost: move svq next desc array to descs state struct
vhost: factor out the descriptor next fetching
vhost: factor out the get of last used desc in SVQ
vhost: factor out the detach buf logic in SVQ
vhost: add in_order feature to shadow virtqueue
vhost: accept in order feature flag

Igor Mammedov (6):
acpi: add API to build WDAT instructions
x86: q35: add 'wdat' property
x86: q35: generate WDAT ACPI table
tests: acpi: x86/q35: whitelist new WDAT table
tests: acpi: x86/q35: add WDAT table test case
tests: acpi: x86/q35: update expected WDAT blob

Jonathan Cameron (1):
MAINTAINERS: Update CXL maintainers entry including adding linux-cxl list

Jorge E. Moreira (1):
vhost-user.rst: Explicitly allow front-end to write to kick FDs

Junjie Cao (2):
intel_iommu: fix guest-triggerable abort on oversized MMIO access tests/qtest: add 8-byte MMIO access sweep for intel-iommu

Kuan-Wei Chiu (3):
vhost-user: Fix stale error logs and return values in teardown paths
standard-headers: Add virtio_rtc.h from Linux 7.0-rc1
virtio-rtc: Add basic virtio-rtc support

Mark Cave-Ayland (4):
hw/acpi/aml-build.c: add aml_irq() representing the 3-byte IRQ descriptor tests/acpi: allow DSDT acpi table changes hw/char/serial-isa.c: declare IRQ as shared in ACPI IRQ descriptor
tests: data: update x86 ACPI tables

Max Makarov (2):
vhost-user-blk-server: do not advertise VIRTIO_BLK_F_SIZE_MAX with size_max=0
vhost-user-blk: do not force VIRTIO_BLK_F_SIZE_MAX

Paolo Bonzini (1):
amd_iommu: restrict command buffer head/tail ranges to ring size

Quan Sun (1):
hw/scsi/vhost-scsi: fix build with older kernel headers

Sairaj Kodilkar (3):
amd_iommu: Use switch case to determine mmio register name
amd_iommu: Turn on XT support only when guest has enabled it
amd_iommu: Generate XT interrupts when xt support is enabled

Shiju Jose (3):
hw/cxl: Fix handling of component ID to not assume it is a string
hw/cxl: Add fixes in Post Package Repair (PPR)
hw/cxl/events: Fix handling of component ID in event records generation to not assume it is a string

Stefano Garzarella (2):
libvhost-user: fix buffer overflow in virtqueue_read_indirect_desc()
libvduse: fix buffer overflow in vduse_queue_read_indirect_desc()

Thomas Huth (1):
hw/i386/pc: Add a proper owner for the ioport memory regions

Vladimir Sementsov-Ogievskiy (32):
vhost-user: rework enabling vrings
vhost: drop backend_features field
vhost-user: introduce vhost_user_has_protocol_feature() helper
vhost: move protocol_features to vhost_user
vhost-user-gpu: drop code duplication
vhost: make vhost_dev.features private
virtio: move common part of _set_guest_notifier to generic code
virtio: drop *_set_guest_notifier_fd_handler() helpers
vhost-user: keep QIOChannelSocket for backend channel
vhost: vhost_virtqueue_start(): fix failure path
vhost: make vhost_memory_unmap() null-safe
vhost: simplify calls to vhost_memory_unmap()
vhost: move vrings mapping to the top of vhost_virtqueue_start()
vhost: vhost_virtqueue_start(): drop extra local variables
vhost: final refactoring of vhost vrings map/unmap
vhost: simplify vhost_dev_init() error-path
vhost: move busyloop timeout initialization to vhost_virtqueue_init()
vhost: vhost_dev_init(): simplify features initialization hw/virtio/virtio-bus: refactor virtio_bus_set_host_notifier()
vhost-user: make trace events more readable
vhost-user-blk: add some useful trace-points
vhost: add some useful trace-points
vhost: move IOTLB functions from vhost-backend.c to vhost.c
vhost: use consistent naming for backend handlers
vhost: rename vhost-backend.c to vhost-kernel.c
vhost: replace .vhost_vq_get_addr() with .vhost_phys_vring_addr()
vhost: simplify vhost_memory_map() and vhost_memory_unmap()
qapi: remove user addresses from x-query-virtio-vhost-queue-status
vhost: stop reusing vq->desc (and friends) to store physical address
vhost: rename vring pointer fields to reflect user addresses
vhost: add .vhost_phys_iotlb_msg() handler
vhost-user: add VHOST_USER_PROTOCOL_F_GPA_ADDRESSES

Zhenzhong Duan (19):
intel_iommu: Remove 'x-' prefix from 'x-scalable-mode' and 'x-flts' properties
intel_iommu: Change 'flts' property naming to 'fsts'
vfio/iommufd: Extend attach/detach_hwpt callback implementations with pasid
iommufd: Extend attach/detach_hwpt callbacks to support pasid
vfio/iommufd: Create nesting parent hwpt with IOMMU_HWPT_ALLOC_PASID flag
intel_iommu: Create the nested hwpt with IOMMU_HWPT_ALLOC_PASID flag
intel_iommu: Rename pasid property to "pasid-bits" and define it as type uint8
intel_iommu: make vtd_dev_get_pe_from_pasid() more generic
intel_iommu: Export some functions
intel_iommu: Fix PASID validity check in fault reporting
intel_iommu: Use IOMMU_NO_PASID and delete PASID_0
intel_iommu: Refactor PASID processing to use IOMMU_NO_PASID internally
intel_iommu_accel: Handle PASID entry addition for pc_inv_dsc request
intel_iommu_accel: Handle PASID entry removal for pc_inv_dsc request
intel_iommu_accel: Bypass PASID entry addition for just deleted entry
intel_iommu_accel: Handle PASID entry removal for system reset
intel_iommu_accel: Switch to VTDAccelPASIDCacheEntry for PASID bind/unbind and PIOTLB invalidation
intel_iommu_accel: Add pasid bits size check
intel_iommu: Expose flag VIOMMU_FLAG_PASID_SUPPORTED and VIOMMU_FLAG_WANT_PASID_ATTACH

 MAINTAINERS                                       |  12 +-
 backends/cryptodev-vhost.c                        |   9 +-
 backends/iommufd.c                                |  23 +-
 backends/vhost-user.c                             |   8 +-
 block/export/vhost-user-blk-server.c              |   2 +-
 docs/devel/vfio-iommufd.rst                       |  10 +-
 docs/interop/vhost-user.rst                       | 135 +++++-
 hw/acpi/aml-build-stub.c                          |   6 +
 hw/acpi/aml-build.c                               |  41 ++
 hw/acpi/meson.build                               |   3 +-
 hw/acpi/wdat-ich9-stub.c                          |  15 +
 hw/acpi/wdat-ich9.c                               |  90 ++++
 hw/arm/smmuv3-accel.c                             |  12 +-
 hw/block/trace-events                             |  10 +
 hw/block/vhost-user-blk.c                         |  36 +-
 hw/char/serial-isa.c                              |   3 +-
 hw/cxl/cxl-component-utils.c                      |   6 +
 hw/cxl/cxl-host.c                                 | 234 ++++++++-
 hw/cxl/cxl-mailbox-utils.c                        |   6 +-
 hw/display/vhost-user-gpu.c                       |  11 +-
 hw/i386/acpi-build.c                              |  12 +
 hw/i386/amd_iommu.c                               | 288 +++++++----
 hw/i386/amd_iommu.h                               |  36 +-
 hw/i386/intel_iommu.c                             | 352 +++++++-------
 hw/i386/intel_iommu_accel.c                       | 401 ++++++++++++---
 hw/i386/intel_iommu_accel.h                       |  20 +-
 hw/i386/intel_iommu_internal.h                    |  44 +-
 hw/i386/pc.c                                      |   6 +-
 hw/i386/pc_q35.c                                  |  18 +
 hw/i386/trace-events                              |   1 +
 hw/mem/cxl_type3.c                                |  17 +-
 hw/net/vhost_net.c                                |  35 +-
 hw/pci-host/pnv_phb3.c                            |  10 +
 hw/pci-host/q35.c                                 |   6 +-
 hw/pci/pci_host.c                                 |  14 +-
 hw/s390x/virtio-ccw.c                             |  35 +-
 hw/scsi/vhost-scsi-common.c                       |   2 +-
 hw/scsi/vhost-scsi.c                              |   2 +-
 hw/scsi/vhost-user-scsi.c                         |   1 -
 hw/vfio/device.c                                  |  11 +
 hw/vfio/iommufd.c                                 |  68 ++-
 hw/vfio/trace-events                              |   4 +-
 hw/virtio/Kconfig                                 |   5 +
 hw/virtio/meson.build                             |   5 +-
 hw/virtio/trace-events                            |  16 +-
 hw/virtio/vdpa-dev.c                              |   3 +-
 hw/virtio/{vhost-backend.c => vhost-kernel.c}     |  90 +---
 hw/virtio/vhost-shadow-virtqueue.c                | 215 ++++++--
 hw/virtio/vhost-shadow-virtqueue.h                |  38 +-
 hw/virtio/vhost-user-base.c                       |  63 ++-
 hw/virtio/vhost-user-fs.c                         |   9 +-
 hw/virtio/vhost-user-scmi.c                       |   9 +-
 hw/virtio/vhost-user-stub.c                       |   6 +
 hw/virtio/vhost-user-test-device-pci.c            |  42 +-
 hw/virtio/vhost-user.c                            | 566 ++++++++++++++++++----
 hw/virtio/vhost-vdpa.c                            |  19 +-
 hw/virtio/vhost-vsock-common.c                    |   9 +-
 hw/virtio/vhost.c                                 | 384 +++++++++------
 hw/virtio/virtio-bus.c                            |  18 +-
 hw/virtio/virtio-hmp-cmds.c                       |   5 -
 hw/virtio/virtio-mmio.c                           |  41 +-
 hw/virtio/virtio-pci.c                            |  34 +-
 hw/virtio/virtio-qmp.c                            |  18 +-
 hw/virtio/virtio-rtc-pci.c                        |  65 +++
 hw/virtio/virtio-rtc.c                            | 190 ++++++++
 hw/virtio/virtio.c                                | 251 +++++++++-
 include/hw/acpi/aml-build.h                       |   2 +
 include/hw/acpi/wdat-ich9.h                       |  15 +
 include/hw/acpi/wdat.h                            | 118 +++++
 include/hw/core/iommu.h                           |  14 +
 include/hw/cxl/cxl.h                              |   1 +
 include/hw/cxl/cxl_device.h                       |   4 +
 include/hw/i386/intel_iommu.h                     |   4 +-
 include/hw/i386/pc.h                              |   1 +
 include/hw/pci-host/q35.h                         |   4 +-
 include/hw/vfio/vfio-device.h                     |   1 +
 include/hw/virtio/vhost-backend.h                 |  47 +-
 include/hw/virtio/vhost-user.h                    |   6 +
 include/hw/virtio/vhost.h                         |  71 ++-
 include/hw/virtio/virtio-pci.h                    |   3 -
 include/hw/virtio/virtio-rtc.h                    |  22 +
 include/hw/virtio/virtio.h                        | 151 +++++-
 include/standard-headers/linux/virtio_rtc.h       | 237 +++++++++
 include/system/iommufd.h                          |  18 +-
 include/system/memory.h                           |   4 +-
 net/vhost-vdpa.c                                  |  37 +-
 qapi/virtio.json                                  |  18 -
 subprojects/libvduse/libvduse.c                   |   7 +-
 subprojects/libvhost-user/libvhost-user.c         |  77 ++-
 subprojects/libvhost-user/libvhost-user.h         |  56 +++
 system/memory.c                                   |  14 +
 tests/data/acpi/x86/microvm/DSDT                  | Bin 365 -> 366 bytes
 tests/data/acpi/x86/microvm/DSDT.ioapic2          | Bin 365 -> 366 bytes
 tests/data/acpi/x86/microvm/DSDT.pcie             | Bin 2985 -> 2986 bytes
 tests/data/acpi/x86/microvm/DSDT.rtc              | Bin 404 -> 405 bytes
 tests/data/acpi/x86/microvm/DSDT.usb              | Bin 414 -> 415 bytes
 tests/data/acpi/x86/pc/DSDT                       | Bin 8598 -> 8599 bytes
 tests/data/acpi/x86/pc/DSDT.acpierst              | Bin 8509 -> 8510 bytes
 tests/data/acpi/x86/pc/DSDT.acpihmat              | Bin 9923 -> 9924 bytes
 tests/data/acpi/x86/pc/DSDT.bridge                | Bin 15469 -> 15470 bytes
 tests/data/acpi/x86/pc/DSDT.cphp                  | Bin 9062 -> 9063 bytes
 tests/data/acpi/x86/pc/DSDT.dimmpxm               | Bin 10252 -> 10253 bytes
 tests/data/acpi/x86/pc/DSDT.hpbridge              | Bin 8549 -> 8550 bytes
 tests/data/acpi/x86/pc/DSDT.hpbrroot              | Bin 5087 -> 5088 bytes
 tests/data/acpi/x86/pc/DSDT.ipmikcs               | Bin 8670 -> 8671 bytes
 tests/data/acpi/x86/pc/DSDT.memhp                 | Bin 9957 -> 9958 bytes
 tests/data/acpi/x86/pc/DSDT.nohpet                | Bin 8456 -> 8457 bytes
 tests/data/acpi/x86/pc/DSDT.numamem               | Bin 8604 -> 8605 bytes
 tests/data/acpi/x86/pc/DSDT.roothp                | Bin 12391 -> 12392 bytes
 tests/data/acpi/x86/q35/DSDT                      | Bin 8427 -> 8428 bytes
 tests/data/acpi/x86/q35/DSDT.acpierst             | Bin 8444 -> 8445 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat             | Bin 9752 -> 9753 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x   | Bin 12637 -> 12638 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8706 -> 8707 bytes
 tests/data/acpi/x86/q35/DSDT.applesmc             | Bin 8473 -> 8474 bytes
 tests/data/acpi/x86/q35/DSDT.bridge               | Bin 12040 -> 12041 bytes
 tests/data/acpi/x86/q35/DSDT.core-count           | Bin 12985 -> 12986 bytes
 tests/data/acpi/x86/q35/DSDT.core-count2          | Bin 33842 -> 33843 bytes
 tests/data/acpi/x86/q35/DSDT.cphp                 | Bin 8891 -> 8892 bytes
 tests/data/acpi/x86/q35/DSDT.cxl                  | Bin 13218 -> 13219 bytes
 tests/data/acpi/x86/q35/DSDT.dimmpxm              | Bin 10081 -> 10082 bytes
 tests/data/acpi/x86/q35/DSDT.ipmibt               | Bin 8502 -> 8503 bytes
 tests/data/acpi/x86/q35/DSDT.ipmismbus            | Bin 8515 -> 8516 bytes
 tests/data/acpi/x86/q35/DSDT.ivrs                 | Bin 8444 -> 8445 bytes
 tests/data/acpi/x86/q35/DSDT.memhp                | Bin 9786 -> 9787 bytes
 tests/data/acpi/x86/q35/DSDT.mmio64               | Bin 9557 -> 9558 bytes
 tests/data/acpi/x86/q35/DSDT.multi-bridge         | Bin 13280 -> 13281 bytes
 tests/data/acpi/x86/q35/DSDT.noacpihp             | Bin 8289 -> 8290 bytes
 tests/data/acpi/x86/q35/DSDT.nohpet               | Bin 8285 -> 8286 bytes
 tests/data/acpi/x86/q35/DSDT.numamem              | Bin 8433 -> 8434 bytes
 tests/data/acpi/x86/q35/DSDT.pvpanic-isa          | Bin 8528 -> 8529 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count         | Bin 12985 -> 12986 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count2        | Bin 33842 -> 33843 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm12            | Bin 9033 -> 9034 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm2             | Bin 9059 -> 9060 bytes
 tests/data/acpi/x86/q35/DSDT.type4-count          | Bin 18661 -> 18662 bytes
 tests/data/acpi/x86/q35/DSDT.viot                 | Bin 14684 -> 14685 bytes
 tests/data/acpi/x86/q35/DSDT.xapic                | Bin 35790 -> 35791 bytes
 tests/data/acpi/x86/q35/WDAT.wdat                 | Bin 0 -> 308 bytes
 tests/qtest/amd-iommu-test.c                      |  76 +++
 tests/qtest/bios-tables-test.c                    |  13 +
 tests/qtest/intel-iommu-test.c                    |  32 +-
 tests/qtest/iommu-intel-test.c                    |   4 +-
 tests/qtest/meson.build                           |   1 +
 144 files changed, 4056 insertions(+), 1158 deletions(-)
 create mode 100644 hw/acpi/wdat-ich9-stub.c
 create mode 100644 hw/acpi/wdat-ich9.c
 rename hw/virtio/{vhost-backend.c => vhost-kernel.c} (83%)
 create mode 100644 hw/virtio/vhost-user-stub.c
 create mode 100644 hw/virtio/virtio-rtc-pci.c
 create mode 100644 hw/virtio/virtio-rtc.c
 create mode 100644 include/hw/acpi/wdat-ich9.h
 create mode 100644 include/hw/acpi/wdat.h
 create mode 100644 include/hw/virtio/virtio-rtc.h
 create mode 100644 include/standard-headers/linux/virtio_rtc.h
 create mode 100644 tests/data/acpi/x86/q35/WDAT.wdat
 create mode 100644 tests/qtest/amd-iommu-test.c
#116 lore raw
Quoted 16 lines · Stefan Hajnoczi
Quoted 3 lines · Michael S. Tsirkin

Resolved a bunch of conflicts.
If you see anything wrong here, pls holler.

Hi Michael,
The check for mangled mailing list author emails is failing. Please git commit --amend --author=... with their real email and resend your pull request:

Alireza Sanaee via qemu development (2):
hw/cxl: Allow cxl_cfmws_find_device() to filter on whether
interleaved paths are accepted
hw/cxl: Add a performant (and correct) path for the non interleaved cases
ERROR: pull request includes commits attributed to list

Quoted 3 lines

Thanks!

Stefan

Fixed now, thanks!

new hash 062c1b7d033e675ea622939

Quoted 354 lines
Quoted 354 lines

The following changes since commit f5a2438405d4ae8b62de7c9b39fac0b2155ee544:

Merge tag 'pull-qapi-2026-05-21' of https://repo.or.cz/qemu/armbru into staging (2026-05-21 09:00:22 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 31dbba011d0f3a21432d0629fae0b4885f2eed25:

hw/scsi/vhost-scsi: fix build with older kernel headers (2026-06-03 08:36:42 -0400)

----------------------------------------------------------------
pci, vhost, virtio, iommu: features, fixes, cleanups

intel_iommu:
PASID support for passthrough
some properties renamed
virtio-rtc:
new device
acpi:
watchdog (x86 q35)
COM irqs are now shared
vhost-user:
vhost-user passes GPA not HVA now
vhost SHMEM_MAP/UNMAP support
vhost-vdpa:
svq IN_ORDER support
amd_iommu:
IOMMU XT interrupt support
command buffer fixes
cxl:
PPR support
performant path for non-interleaved cases
vhost-scsi:
build fix for older kernel headers
fixes, cleanups all over the place

----------------------------------------------------------------
Aditya Gupta (2):
ppc/pnv_phb3: Error out on invalid config access hw/pci: Replace assert with bounds check and return

Albert Esteve (7):
vhost-user: Add VirtIO Shared Memory map request vhost_user.rst: Align VhostUserMsg excerpt members vhost_user.rst: Add SHMEM_MAP/_UNMAP to spec
vhost_user: Add frontend get_shmem_config command vhost_user.rst: Add GET_SHMEM_CONFIG message
qmp: add shmem feature map
vhost-user-device: Add shared memory BAR

Alejandro Jimenez (3):
amd_iommu: Update command buffer head ptr in MMIO region after wraparound
amd_iommu: Follow root pointer before page walk and use 1-based levels
amd_iommu: Reject non-decreasing NextLevel in fetch_pte()

Alexandr Moshkov (1):
vhost-user.rst: fix typo

Alexey Gerasimenko (1):
q35: Fix incorrect values for PCIEXBAR masks

Alireza Sanaee via qemu development (2):
hw/cxl: Allow cxl_cfmws_find_device() to filter on whether interleaved paths are accepted hw/cxl: Add a performant (and correct) path for the non interleaved cases

Costas Argyris (1):
tests/qtest: Add amd-iommu command buffer head wrap test

Eugenio Pérez (8):
net/vhost-vdpa: enable vqs before DRIVER_OK if no cvq
virtio: Allow to fill a whole virtqueue in order
vhost: move svq next desc array to descs state struct
vhost: factor out the descriptor next fetching
vhost: factor out the get of last used desc in SVQ
vhost: factor out the detach buf logic in SVQ
vhost: add in_order feature to shadow virtqueue
vhost: accept in order feature flag

Igor Mammedov (6):
acpi: add API to build WDAT instructions
x86: q35: add 'wdat' property
x86: q35: generate WDAT ACPI table
tests: acpi: x86/q35: whitelist new WDAT table
tests: acpi: x86/q35: add WDAT table test case
tests: acpi: x86/q35: update expected WDAT blob

Jonathan Cameron (1):
MAINTAINERS: Update CXL maintainers entry including adding linux-cxl list

Jorge E. Moreira (1):
vhost-user.rst: Explicitly allow front-end to write to kick FDs

Junjie Cao (2):
intel_iommu: fix guest-triggerable abort on oversized MMIO access tests/qtest: add 8-byte MMIO access sweep for intel-iommu

Kuan-Wei Chiu (3):
vhost-user: Fix stale error logs and return values in teardown paths
standard-headers: Add virtio_rtc.h from Linux 7.0-rc1
virtio-rtc: Add basic virtio-rtc support

Mark Cave-Ayland (4):
hw/acpi/aml-build.c: add aml_irq() representing the 3-byte IRQ descriptor tests/acpi: allow DSDT acpi table changes hw/char/serial-isa.c: declare IRQ as shared in ACPI IRQ descriptor
tests: data: update x86 ACPI tables

Max Makarov (2):
vhost-user-blk-server: do not advertise VIRTIO_BLK_F_SIZE_MAX with size_max=0
vhost-user-blk: do not force VIRTIO_BLK_F_SIZE_MAX

Paolo Bonzini (1):
amd_iommu: restrict command buffer head/tail ranges to ring size

Quan Sun (1):
hw/scsi/vhost-scsi: fix build with older kernel headers

Sairaj Kodilkar (3):
amd_iommu: Use switch case to determine mmio register name
amd_iommu: Turn on XT support only when guest has enabled it
amd_iommu: Generate XT interrupts when xt support is enabled

Shiju Jose (3):
hw/cxl: Fix handling of component ID to not assume it is a string
hw/cxl: Add fixes in Post Package Repair (PPR)
hw/cxl/events: Fix handling of component ID in event records generation to not assume it is a string

Stefano Garzarella (2):
libvhost-user: fix buffer overflow in virtqueue_read_indirect_desc()
libvduse: fix buffer overflow in vduse_queue_read_indirect_desc()

Thomas Huth (1):
hw/i386/pc: Add a proper owner for the ioport memory regions

Vladimir Sementsov-Ogievskiy (32):
vhost-user: rework enabling vrings
vhost: drop backend_features field
vhost-user: introduce vhost_user_has_protocol_feature() helper
vhost: move protocol_features to vhost_user
vhost-user-gpu: drop code duplication
vhost: make vhost_dev.features private
virtio: move common part of _set_guest_notifier to generic code
virtio: drop *_set_guest_notifier_fd_handler() helpers
vhost-user: keep QIOChannelSocket for backend channel
vhost: vhost_virtqueue_start(): fix failure path
vhost: make vhost_memory_unmap() null-safe
vhost: simplify calls to vhost_memory_unmap()
vhost: move vrings mapping to the top of vhost_virtqueue_start()
vhost: vhost_virtqueue_start(): drop extra local variables
vhost: final refactoring of vhost vrings map/unmap
vhost: simplify vhost_dev_init() error-path
vhost: move busyloop timeout initialization to vhost_virtqueue_init()
vhost: vhost_dev_init(): simplify features initialization hw/virtio/virtio-bus: refactor virtio_bus_set_host_notifier()
vhost-user: make trace events more readable
vhost-user-blk: add some useful trace-points
vhost: add some useful trace-points
vhost: move IOTLB functions from vhost-backend.c to vhost.c
vhost: use consistent naming for backend handlers
vhost: rename vhost-backend.c to vhost-kernel.c
vhost: replace .vhost_vq_get_addr() with .vhost_phys_vring_addr()
vhost: simplify vhost_memory_map() and vhost_memory_unmap()
qapi: remove user addresses from x-query-virtio-vhost-queue-status
vhost: stop reusing vq->desc (and friends) to store physical address
vhost: rename vring pointer fields to reflect user addresses
vhost: add .vhost_phys_iotlb_msg() handler
vhost-user: add VHOST_USER_PROTOCOL_F_GPA_ADDRESSES

Zhenzhong Duan (19):
intel_iommu: Remove 'x-' prefix from 'x-scalable-mode' and 'x-flts' properties
intel_iommu: Change 'flts' property naming to 'fsts'
vfio/iommufd: Extend attach/detach_hwpt callback implementations with pasid
iommufd: Extend attach/detach_hwpt callbacks to support pasid
vfio/iommufd: Create nesting parent hwpt with IOMMU_HWPT_ALLOC_PASID flag
intel_iommu: Create the nested hwpt with IOMMU_HWPT_ALLOC_PASID flag
intel_iommu: Rename pasid property to "pasid-bits" and define it as type uint8
intel_iommu: make vtd_dev_get_pe_from_pasid() more generic
intel_iommu: Export some functions
intel_iommu: Fix PASID validity check in fault reporting
intel_iommu: Use IOMMU_NO_PASID and delete PASID_0
intel_iommu: Refactor PASID processing to use IOMMU_NO_PASID internally
intel_iommu_accel: Handle PASID entry addition for pc_inv_dsc request
intel_iommu_accel: Handle PASID entry removal for pc_inv_dsc request
intel_iommu_accel: Bypass PASID entry addition for just deleted entry
intel_iommu_accel: Handle PASID entry removal for system reset
intel_iommu_accel: Switch to VTDAccelPASIDCacheEntry for PASID bind/unbind and PIOTLB invalidation
intel_iommu_accel: Add pasid bits size check
intel_iommu: Expose flag VIOMMU_FLAG_PASID_SUPPORTED and VIOMMU_FLAG_WANT_PASID_ATTACH

 MAINTAINERS                                       |  12 +-
 backends/cryptodev-vhost.c                        |   9 +-
 backends/iommufd.c                                |  23 +-
 backends/vhost-user.c                             |   8 +-
 block/export/vhost-user-blk-server.c              |   2 +-
 docs/devel/vfio-iommufd.rst                       |  10 +-
 docs/interop/vhost-user.rst                       | 135 +++++-
 hw/acpi/aml-build-stub.c                          |   6 +
 hw/acpi/aml-build.c                               |  41 ++
 hw/acpi/meson.build                               |   3 +-
 hw/acpi/wdat-ich9-stub.c                          |  15 +
 hw/acpi/wdat-ich9.c                               |  90 ++++
 hw/arm/smmuv3-accel.c                             |  12 +-
 hw/block/trace-events                             |  10 +
 hw/block/vhost-user-blk.c                         |  36 +-
 hw/char/serial-isa.c                              |   3 +-
 hw/cxl/cxl-component-utils.c                      |   6 +
 hw/cxl/cxl-host.c                                 | 234 ++++++++-
 hw/cxl/cxl-mailbox-utils.c                        |   6 +-
 hw/display/vhost-user-gpu.c                       |  11 +-
 hw/i386/acpi-build.c                              |  12 +
 hw/i386/amd_iommu.c                               | 288 +++++++----
 hw/i386/amd_iommu.h                               |  36 +-
 hw/i386/intel_iommu.c                             | 352 +++++++-------
 hw/i386/intel_iommu_accel.c                       | 401 ++++++++++++---
 hw/i386/intel_iommu_accel.h                       |  20 +-
 hw/i386/intel_iommu_internal.h                    |  44 +-
 hw/i386/pc.c                                      |   6 +-
 hw/i386/pc_q35.c                                  |  18 +
 hw/i386/trace-events                              |   1 +
 hw/mem/cxl_type3.c                                |  17 +-
 hw/net/vhost_net.c                                |  35 +-
 hw/pci-host/pnv_phb3.c                            |  10 +
 hw/pci-host/q35.c                                 |   6 +-
 hw/pci/pci_host.c                                 |  14 +-
 hw/s390x/virtio-ccw.c                             |  35 +-
 hw/scsi/vhost-scsi-common.c                       |   2 +-
 hw/scsi/vhost-scsi.c                              |   2 +-
 hw/scsi/vhost-user-scsi.c                         |   1 -
 hw/vfio/device.c                                  |  11 +
 hw/vfio/iommufd.c                                 |  68 ++-
 hw/vfio/trace-events                              |   4 +-
 hw/virtio/Kconfig                                 |   5 +
 hw/virtio/meson.build                             |   5 +-
 hw/virtio/trace-events                            |  16 +-
 hw/virtio/vdpa-dev.c                              |   3 +-
 hw/virtio/{vhost-backend.c => vhost-kernel.c}     |  90 +---
 hw/virtio/vhost-shadow-virtqueue.c                | 215 ++++++--
 hw/virtio/vhost-shadow-virtqueue.h                |  38 +-
 hw/virtio/vhost-user-base.c                       |  63 ++-
 hw/virtio/vhost-user-fs.c                         |   9 +-
 hw/virtio/vhost-user-scmi.c                       |   9 +-
 hw/virtio/vhost-user-stub.c                       |   6 +
 hw/virtio/vhost-user-test-device-pci.c            |  42 +-
 hw/virtio/vhost-user.c                            | 566 ++++++++++++++++++----
 hw/virtio/vhost-vdpa.c                            |  19 +-
 hw/virtio/vhost-vsock-common.c                    |   9 +-
 hw/virtio/vhost.c                                 | 384 +++++++++------
 hw/virtio/virtio-bus.c                            |  18 +-
 hw/virtio/virtio-hmp-cmds.c                       |   5 -
 hw/virtio/virtio-mmio.c                           |  41 +-
 hw/virtio/virtio-pci.c                            |  34 +-
 hw/virtio/virtio-qmp.c                            |  18 +-
 hw/virtio/virtio-rtc-pci.c                        |  65 +++
 hw/virtio/virtio-rtc.c                            | 190 ++++++++
 hw/virtio/virtio.c                                | 251 +++++++++-
 include/hw/acpi/aml-build.h                       |   2 +
 include/hw/acpi/wdat-ich9.h                       |  15 +
 include/hw/acpi/wdat.h                            | 118 +++++
 include/hw/core/iommu.h                           |  14 +
 include/hw/cxl/cxl.h                              |   1 +
 include/hw/cxl/cxl_device.h                       |   4 +
 include/hw/i386/intel_iommu.h                     |   4 +-
 include/hw/i386/pc.h                              |   1 +
 include/hw/pci-host/q35.h                         |   4 +-
 include/hw/vfio/vfio-device.h                     |   1 +
 include/hw/virtio/vhost-backend.h                 |  47 +-
 include/hw/virtio/vhost-user.h                    |   6 +
 include/hw/virtio/vhost.h                         |  71 ++-
 include/hw/virtio/virtio-pci.h                    |   3 -
 include/hw/virtio/virtio-rtc.h                    |  22 +
 include/hw/virtio/virtio.h                        | 151 +++++-
 include/standard-headers/linux/virtio_rtc.h       | 237 +++++++++
 include/system/iommufd.h                          |  18 +-
 include/system/memory.h                           |   4 +-
 net/vhost-vdpa.c                                  |  37 +-
 qapi/virtio.json                                  |  18 -
 subprojects/libvduse/libvduse.c                   |   7 +-
 subprojects/libvhost-user/libvhost-user.c         |  77 ++-
 subprojects/libvhost-user/libvhost-user.h         |  56 +++
 system/memory.c                                   |  14 +
 tests/data/acpi/x86/microvm/DSDT                  | Bin 365 -> 366 bytes
 tests/data/acpi/x86/microvm/DSDT.ioapic2          | Bin 365 -> 366 bytes
 tests/data/acpi/x86/microvm/DSDT.pcie             | Bin 2985 -> 2986 bytes
 tests/data/acpi/x86/microvm/DSDT.rtc              | Bin 404 -> 405 bytes
 tests/data/acpi/x86/microvm/DSDT.usb              | Bin 414 -> 415 bytes
 tests/data/acpi/x86/pc/DSDT                       | Bin 8598 -> 8599 bytes
 tests/data/acpi/x86/pc/DSDT.acpierst              | Bin 8509 -> 8510 bytes
 tests/data/acpi/x86/pc/DSDT.acpihmat              | Bin 9923 -> 9924 bytes
 tests/data/acpi/x86/pc/DSDT.bridge                | Bin 15469 -> 15470 bytes
 tests/data/acpi/x86/pc/DSDT.cphp                  | Bin 9062 -> 9063 bytes
 tests/data/acpi/x86/pc/DSDT.dimmpxm               | Bin 10252 -> 10253 bytes
 tests/data/acpi/x86/pc/DSDT.hpbridge              | Bin 8549 -> 8550 bytes
 tests/data/acpi/x86/pc/DSDT.hpbrroot              | Bin 5087 -> 5088 bytes
 tests/data/acpi/x86/pc/DSDT.ipmikcs               | Bin 8670 -> 8671 bytes
 tests/data/acpi/x86/pc/DSDT.memhp                 | Bin 9957 -> 9958 bytes
 tests/data/acpi/x86/pc/DSDT.nohpet                | Bin 8456 -> 8457 bytes
 tests/data/acpi/x86/pc/DSDT.numamem               | Bin 8604 -> 8605 bytes
 tests/data/acpi/x86/pc/DSDT.roothp                | Bin 12391 -> 12392 bytes
 tests/data/acpi/x86/q35/DSDT                      | Bin 8427 -> 8428 bytes
 tests/data/acpi/x86/q35/DSDT.acpierst             | Bin 8444 -> 8445 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat             | Bin 9752 -> 9753 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x   | Bin 12637 -> 12638 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8706 -> 8707 bytes
 tests/data/acpi/x86/q35/DSDT.applesmc             | Bin 8473 -> 8474 bytes
 tests/data/acpi/x86/q35/DSDT.bridge               | Bin 12040 -> 12041 bytes
 tests/data/acpi/x86/q35/DSDT.core-count           | Bin 12985 -> 12986 bytes
 tests/data/acpi/x86/q35/DSDT.core-count2          | Bin 33842 -> 33843 bytes
 tests/data/acpi/x86/q35/DSDT.cphp                 | Bin 8891 -> 8892 bytes
 tests/data/acpi/x86/q35/DSDT.cxl                  | Bin 13218 -> 13219 bytes
 tests/data/acpi/x86/q35/DSDT.dimmpxm              | Bin 10081 -> 10082 bytes
 tests/data/acpi/x86/q35/DSDT.ipmibt               | Bin 8502 -> 8503 bytes
 tests/data/acpi/x86/q35/DSDT.ipmismbus            | Bin 8515 -> 8516 bytes
 tests/data/acpi/x86/q35/DSDT.ivrs                 | Bin 8444 -> 8445 bytes
 tests/data/acpi/x86/q35/DSDT.memhp                | Bin 9786 -> 9787 bytes
 tests/data/acpi/x86/q35/DSDT.mmio64               | Bin 9557 -> 9558 bytes
 tests/data/acpi/x86/q35/DSDT.multi-bridge         | Bin 13280 -> 13281 bytes
 tests/data/acpi/x86/q35/DSDT.noacpihp             | Bin 8289 -> 8290 bytes
 tests/data/acpi/x86/q35/DSDT.nohpet               | Bin 8285 -> 8286 bytes
 tests/data/acpi/x86/q35/DSDT.numamem              | Bin 8433 -> 8434 bytes
 tests/data/acpi/x86/q35/DSDT.pvpanic-isa          | Bin 8528 -> 8529 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count         | Bin 12985 -> 12986 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count2        | Bin 33842 -> 33843 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm12            | Bin 9033 -> 9034 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm2             | Bin 9059 -> 9060 bytes
 tests/data/acpi/x86/q35/DSDT.type4-count          | Bin 18661 -> 18662 bytes
 tests/data/acpi/x86/q35/DSDT.viot                 | Bin 14684 -> 14685 bytes
 tests/data/acpi/x86/q35/DSDT.xapic                | Bin 35790 -> 35791 bytes
 tests/data/acpi/x86/q35/WDAT.wdat                 | Bin 0 -> 308 bytes
 tests/qtest/amd-iommu-test.c                      |  76 +++
 tests/qtest/bios-tables-test.c                    |  13 +
 tests/qtest/intel-iommu-test.c                    |  32 +-
 tests/qtest/iommu-intel-test.c                    |   4 +-
 tests/qtest/meson.build                           |   1 +
 144 files changed, 4056 insertions(+), 1158 deletions(-)
 create mode 100644 hw/acpi/wdat-ich9-stub.c
 create mode 100644 hw/acpi/wdat-ich9.c
 rename hw/virtio/{vhost-backend.c => vhost-kernel.c} (83%)
 create mode 100644 hw/virtio/vhost-user-stub.c
 create mode 100644 hw/virtio/virtio-rtc-pci.c
 create mode 100644 hw/virtio/virtio-rtc.c
 create mode 100644 include/hw/acpi/wdat-ich9.h
 create mode 100644 include/hw/acpi/wdat.h
 create mode 100644 include/hw/virtio/virtio-rtc.h
 create mode 100644 include/standard-headers/linux/virtio_rtc.h
 create mode 100644 tests/data/acpi/x86/q35/WDAT.wdat
 create mode 100644 tests/qtest/amd-iommu-test.c
#111 lore raw

Re: [PULL 063/106] amd_iommu: Follow root pointer before page walk and use 1-based levels

In reply to Michael S. Tsirkin
Quoted 14 lines · Michael S. Tsirkin

From: Alejandro Jimenez <[email protected]>

DTE[Mode] and PTE NextLevel encode page table levels as 1-based values, but fetch_pte() currently uses a 0-based level counter, making the logic harder to follow and requiring conversions between DTE mode and level.

Switch the page table walk logic to use 1-based level accounting in fetch_pte() and the relevant macro helpers. To further simplify the page walking loop, split the root page table access from the walk i.e. rework fetch_pte() to follow the DTE Page Table Root Pointer and retrieve the top level pagetable entry before entering the loop, then iterate only over the PDE/PTE entries.

Quoted 4 lines

The reworked algorithm fixes a page walk bug where the page size was calculated for the next level before checking if the current PTE was already a leaf/hugepage. That caused hugepage mappings to be reported as 4K pages, leading to performance degradation and failures in some setups.

Hi; Coverity flags up an issue with this commit. It won't have any practical consequences, but it does show that there's something we could clean up.

Quoted 7 lines
hw/i386/amd_iommu.c +7 -0
+/*
+ * Validate DTE fields and extract permissions and top level data required to
+ * initiate the page table walk.
+ *
+ * On success, returns 0 and stores:
+ *   - top_level: highest page-table level encoded in DTE[Mode]
+ *   - dte_perms: effective permissions from the DTE

hw/i386/amd_iommu.c static uint64_t large_pte_page_size(uint64_t pte) · line 667

Quoted 10 lines
hw/i386/amd_iommu.c +10 -0
+ *
+ * On failure, returns -AMDVI_FR_PT_ROOT_INV. This includes cases where:
+ *   - DTE permissions disallow read AND write
+ *   - DTE[Mode] is invalid for translation
+ *   - IOVA exceeds the address width supported by DTE[Mode]
+ * In all such cases a page walk must be aborted.
+ */
+static uint64_t amdvi_get_top_pt_level_and_perms(hwaddr address, uint64_t dte,
+                                                 uint8_t *top_level,
+                                                 IOMMUAccessFlags *dte_perms)

This function returns 0 on success, or a small negative number on failure. But we have typed it as returning uint64_t.

Quoted 11 lines
hw/i386/amd_iommu.c +3 -3
@@ -662,40 +708,49 @@ static uint64_t large_pte_page_size(uint64_t pte)
 static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
                           uint64_t *pte, hwaddr *page_size)
 {
-    IOMMUAccessFlags perms = amdvi_get_perms(dte);
-
-    uint8_t level, mode;
     uint64_t pte_addr;
+    uint8_t pt_level, next_pt_level;
+    IOMMUAccessFlags perms;
+    int ret;

hw/i386/amd_iommu.c static uint64_t large_pte_page_size(uint64_t pte) · line 722

Quoted 10 lines
hw/i386/amd_iommu.c +5 -2
 
-    *pte = dte;
     *page_size = 0;
 
-    if (perms == IOMMU_NONE) {
+    /*
+     * Verify the DTE is properly configured before page walk, and extract
+     * top pagetable level and permissions.
+     */
+    ret = amdvi_get_top_pt_level_and_perms(address, dte, &pt_level, &perms);

At the callsite we take that uint64_t return value and put it into an "int" local variable. That potentially overflows. (In practice none of the values actually returned will overflow.)

hw/i386/amd_iommu.c static uint64_t large_pte_page_size(uint64_t pte) · line 724

Quoted 2 lines
hw/i386/amd_iommu.c +2 -0
+    if (ret < 0) {
+        return ret;

Then we return that 'int' value from this function, which extends it back out to uint64_t again.

Review static uint64_t large_pte_page_size(uint64_t pte) · line 725

Quoted 1 line
(quoted diff) +1 -0
+    }

Since all of fetch_pte()'s callers put its return value into an 'int' local variable, and fetch_pte() is the only function that calls amdvi_get_top_pt_level_and_perms(), I think the right fix here is to make both amdvi_get_top_pt_level_and_perms() and fetch_pte() return "int" instead of "uint64_t". Then the type matches what the return variable is (0 on success, small negative on failure) and also the type of the variable that all the callers put it into.

thanks
-- PMM

#112 lore raw

Re: [PULL 063/106] amd_iommu: Follow root pointer before page walk and use 1-based levels

Quoted 79 lines · Peter Maydell
Quoted 14 lines · Michael S. Tsirkin

From: Alejandro Jimenez <[email protected]>

DTE[Mode] and PTE NextLevel encode page table levels as 1-based values, but fetch_pte() currently uses a 0-based level counter, making the logic harder to follow and requiring conversions between DTE mode and level.

Switch the page table walk logic to use 1-based level accounting in fetch_pte() and the relevant macro helpers. To further simplify the page walking loop, split the root page table access from the walk i.e. rework fetch_pte() to follow the DTE Page Table Root Pointer and retrieve the top level pagetable entry before entering the loop, then iterate only over the PDE/PTE entries.

Quoted 4 lines

The reworked algorithm fixes a page walk bug where the page size was calculated for the next level before checking if the current PTE was already a leaf/hugepage. That caused hugepage mappings to be reported as 4K pages, leading to performance degradation and failures in some setups.

Hi; Coverity flags up an issue with this commit. It won't have any practical consequences, but it does show that there's something we could clean up.

Quoted 7 lines
hw/i386/amd_iommu.c +7 -0
+/*
+ * Validate DTE fields and extract permissions and top level data required to
+ * initiate the page table walk.
+ *
+ * On success, returns 0 and stores:
+ *   - top_level: highest page-table level encoded in DTE[Mode]
+ *   - dte_perms: effective permissions from the DTE

hw/i386/amd_iommu.c static uint64_t large_pte_page_size(uint64_t pte) · line 667

Quoted 10 lines
hw/i386/amd_iommu.c +10 -0
+ *
+ * On failure, returns -AMDVI_FR_PT_ROOT_INV. This includes cases where:
+ *   - DTE permissions disallow read AND write
+ *   - DTE[Mode] is invalid for translation
+ *   - IOVA exceeds the address width supported by DTE[Mode]
+ * In all such cases a page walk must be aborted.
+ */
+static uint64_t amdvi_get_top_pt_level_and_perms(hwaddr address, uint64_t dte,
+                                                 uint8_t *top_level,
+                                                 IOMMUAccessFlags *dte_perms)

This function returns 0 on success, or a small negative number on failure. But we have typed it as returning uint64_t.

Quoted 11 lines
hw/i386/amd_iommu.c +3 -3
@@ -662,40 +708,49 @@ static uint64_t large_pte_page_size(uint64_t pte)
 static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
                           uint64_t *pte, hwaddr *page_size)
 {
-    IOMMUAccessFlags perms = amdvi_get_perms(dte);
-
-    uint8_t level, mode;
     uint64_t pte_addr;
+    uint8_t pt_level, next_pt_level;
+    IOMMUAccessFlags perms;
+    int ret;

hw/i386/amd_iommu.c static uint64_t large_pte_page_size(uint64_t pte) · line 722

Quoted 10 lines
hw/i386/amd_iommu.c +5 -2
 
-    *pte = dte;
     *page_size = 0;
 
-    if (perms == IOMMU_NONE) {
+    /*
+     * Verify the DTE is properly configured before page walk, and extract
+     * top pagetable level and permissions.
+     */
+    ret = amdvi_get_top_pt_level_and_perms(address, dte, &pt_level, &perms);

At the callsite we take that uint64_t return value and put it into an "int" local variable. That potentially overflows. (In practice none of the values actually returned will overflow.)

hw/i386/amd_iommu.c static uint64_t large_pte_page_size(uint64_t pte) · line 724

Quoted 2 lines
hw/i386/amd_iommu.c +2 -0
+    if (ret < 0) {
+        return ret;

Then we return that 'int' value from this function, which extends it back out to uint64_t again.

Review static uint64_t large_pte_page_size(uint64_t pte) · line 725

Quoted 1 line
(quoted diff) +1 -0
+    }
Quoted 8 lines

Since all of fetch_pte()'s callers put its return value into an 'int' local variable, and fetch_pte() is the only function that calls amdvi_get_top_pt_level_and_perms(), I think the right fix here is to make both amdvi_get_top_pt_level_and_perms() and fetch_pte() return "int" instead of "uint64_t". Then the type matches what the return variable is (0 on success, small negative on failure) and also the type of the variable that all the callers put it into.

Thank you for pointing this out.

This started when I initially introduced fetch_pte() as an unused helper, returning the PTE value directly. After feedback, I changed it to return an "int", but a later patch in the series accidentally reverted back to "uint64_t". Then I repeated the same wrong pattern in amdvi_get_top_pt_level_and_perms().

I'll send a patch making both amdvi_get_top_pt_level_and_perms() and fetch_pte() return "int".

Thank you,
Alejandro

Quoted 2 lines

thanks
-- PMM

#54 lore raw

Re: [PULL 081/106] amd_iommu: Generate XT interrupts when xt support is enabled

In reply to a message not in the archive
Quoted 90 lines · Peter Maydell
Quoted 9 lines · Michael S. Tsirkin

From: Sairaj Kodilkar <[email protected]>

When MMIO 0x18[IntCapXTEn]=1, interrupts originating from the IOMMU itself are sent based on the programming in XT IOMMU Interrupt Control Registers in MMIO 0x170-0x180 instead of the programming in the IOMMU's MSI capability registers. The guest programs these registers with appropriate vector and destination ID instead of writing to PCI MSI capability.

Quoted 8 lines

Current AMD vIOMMU is capable of generating interrupts only through PCI MSI capability and does not care about xt mode. Because of this AMD vIOMMU cannot generate event log interrupts when the guest has enabled xt mode.

Introduce a new flag "intcapxten" which is set when guest writes control register [IntCapXTEn] (bit 51) and use vector and destination field in the XT MMIO register (0x170) to support XT mode.

Hi; Coverity points out a use of an uninitialized struct field here (CID 1660056):

hw/i386/amd_iommu.c static void amdvi_assign_andq(AMDVIState *s, hwaddr addr, uint64_t val) · line 198

Quoted 4 lines
hw/i386/amd_iommu.c +4 -0
+static void amdvi_build_xt_msi_msg(AMDVIState *s, MSIMessage *msg)
+{
+    union mmio_xt_intr xt_reg;
+    struct X86IOMMUIrq irq;

Here we declare irq, without a struct initializer...

hw/i386/amd_iommu.c static void amdvi_assign_andq(AMDVIState *s, hwaddr addr, uint64_t val) · line 207

Quoted 9 lines
hw/i386/amd_iommu.c +9 -0
+
+    xt_reg.val = amdvi_readq(s, AMDVI_MMIO_XT_GEN_INTR);
+
+    irq.vector = xt_reg.vector;
+    irq.delivery_mode = xt_reg.delivery_mode;
+    irq.dest_mode = xt_reg.destination_mode;
+    irq.dest = (xt_reg.destination_hi << 24) | xt_reg.destination_lo;
+    irq.trigger_mode = 0;
+    irq.redir_hint = 0;

...and here we fill in some but not all of its fields...

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+    x86_iommu_irq_to_msi_message(&irq, msg);

...and here we call a function which (among other things) does this:

   msg.__not_used = irq->msi_addr_last_bits;

which will read the uninitialized msi_addr_last_bits field.

Bonus extra bug report:

hw/i386/amd_iommu.h +13 -0
+union mmio_xt_intr {
+    uint64_t val;
+    struct {
+        uint64_t rsvd_1:2,
+                 destination_mode:1,
+                 rsvd_2:5,
+                 destination_lo:24,
+                 vector:8,
+                 delivery_mode:1,
+                 rsvd_3:15,
+                 destination_hi:8;
+    };
+};

Please don't use bitfields like this -- this is not portable to big endian hosts. Use the extract64() function instead, or the FIELD macros.

I suggest something like (untested):

(at top level in a source file or header; the numbers are start-bit and length, check these as I may have made typos)

FIELD(XT_GEN_INTR, DEST_MODE, 2, 1)
FIELD(XT_GEN_INTR, DEST_LO, 24, 8)
FIELD(XT_GEN_INTR, VECTOR, 32, 8)
FIELD(XT_GEN_INTR, DELIVERY_MODE, 33, 1)
FIELD(XT_GEN_INTR, DEST_HI, 49, 8)

and then in the function you can do:

   uint64_t xtreg = amdvi_readq(s, AMDVI_MMIO_XT_GEN_INTR);
   X86IOMMUIrq irq = {
       .vector = FIELD_EX64(xtreg, XT_GEN_INTR, VECTOR),
       .delivery_mode = FIELD_EX64(xtreg, XT_GEN_INTR, DELIVERY_MODE),
       .dest_mode = FIELD_EX64(xtreg, XT_GEN_INTR, DEST_MODE),
       .dest = (FIELD_X64(xtreg, XT_GEN_INTR, DEST_HI) << 24) |

FIELD_EX64(xtreg, XT_GEN_INTR, DEST_LO),
};

Quoted 7 lines

which gives you a struct initializer and you can rely on the whole struct being initialized.

Quoted 1 line

+}

thanks
-- PMM

Indeed. Alejandro should we revert or fix up?

Signature · 1 line
MST
#55 lore raw

Re: [PULL 081/106] amd_iommu: Generate XT interrupts when xt support is enabled

Quoted 94 lines · Michael S. Tsirkin
Quoted 93 lines · Peter Maydell
Quoted 9 lines · Michael S. Tsirkin

From: Sairaj Kodilkar <[email protected]>

When MMIO 0x18[IntCapXTEn]=1, interrupts originating from the IOMMU itself are sent based on the programming in XT IOMMU Interrupt Control Registers in MMIO 0x170-0x180 instead of the programming in the IOMMU's MSI capability registers. The guest programs these registers with appropriate vector and destination ID instead of writing to PCI MSI capability.

Quoted 8 lines

Current AMD vIOMMU is capable of generating interrupts only through PCI MSI capability and does not care about xt mode. Because of this AMD vIOMMU cannot generate event log interrupts when the guest has enabled xt mode.

Introduce a new flag "intcapxten" which is set when guest writes control register [IntCapXTEn] (bit 51) and use vector and destination field in the XT MMIO register (0x170) to support XT mode.

Hi; Coverity points out a use of an uninitialized struct field here (CID 1660056):

hw/i386/amd_iommu.c static void amdvi_assign_andq(AMDVIState *s, hwaddr addr, uint64_t val) · line 198

Quoted 4 lines
hw/i386/amd_iommu.c +4 -0
+static void amdvi_build_xt_msi_msg(AMDVIState *s, MSIMessage *msg)
+{
+    union mmio_xt_intr xt_reg;
+    struct X86IOMMUIrq irq;

Here we declare irq, without a struct initializer...

hw/i386/amd_iommu.c static void amdvi_assign_andq(AMDVIState *s, hwaddr addr, uint64_t val) · line 207

Quoted 9 lines
hw/i386/amd_iommu.c +9 -0
+
+    xt_reg.val = amdvi_readq(s, AMDVI_MMIO_XT_GEN_INTR);
+
+    irq.vector = xt_reg.vector;
+    irq.delivery_mode = xt_reg.delivery_mode;
+    irq.dest_mode = xt_reg.destination_mode;
+    irq.dest = (xt_reg.destination_hi << 24) | xt_reg.destination_lo;
+    irq.trigger_mode = 0;
+    irq.redir_hint = 0;

...and here we fill in some but not all of its fields...

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+    x86_iommu_irq_to_msi_message(&irq, msg);

...and here we call a function which (among other things) does this:

   msg.__not_used = irq->msi_addr_last_bits;

which will read the uninitialized msi_addr_last_bits field.

Bonus extra bug report:

hw/i386/amd_iommu.h +13 -0
+union mmio_xt_intr {
+    uint64_t val;
+    struct {
+        uint64_t rsvd_1:2,
+                 destination_mode:1,
+                 rsvd_2:5,
+                 destination_lo:24,
+                 vector:8,
+                 delivery_mode:1,
+                 rsvd_3:15,
+                 destination_hi:8;
+    };
+};

Please don't use bitfields like this -- this is not portable to big endian hosts. Use the extract64() function instead, or the FIELD macros.

I suggest something like (untested):

(at top level in a source file or header; the numbers are start-bit and length, check these as I may have made typos)

FIELD(XT_GEN_INTR, DEST_MODE, 2, 1)
FIELD(XT_GEN_INTR, DEST_LO, 24, 8)
FIELD(XT_GEN_INTR, VECTOR, 32, 8)
FIELD(XT_GEN_INTR, DELIVERY_MODE, 33, 1)
FIELD(XT_GEN_INTR, DEST_HI, 49, 8)

and then in the function you can do:

   uint64_t xtreg = amdvi_readq(s, AMDVI_MMIO_XT_GEN_INTR);
   X86IOMMUIrq irq = {
       .vector = FIELD_EX64(xtreg, XT_GEN_INTR, VECTOR),
       .delivery_mode = FIELD_EX64(xtreg, XT_GEN_INTR, DELIVERY_MODE),
       .dest_mode = FIELD_EX64(xtreg, XT_GEN_INTR, DEST_MODE),
       .dest = (FIELD_X64(xtreg, XT_GEN_INTR, DEST_HI) << 24) |

FIELD_EX64(xtreg, XT_GEN_INTR, DEST_LO),
};

which gives you a struct initializer and you can rely on the whole struct being initialized.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

+}

thanks
-- PMM

Indeed. Alejandro should we revert or fix up?

I think the uninitialized struct issue can be quickly fixed using a designated initializer, so that would directly address CID 1660056.

For the bitfield portability in big endian host problem, the changes are a bit more involved since there are existing definitions using the same pattern (dating back to 2018 when IR support was introduced). So to do it right it involves more changes than just the code touched by the current patch. It should be relatively straightforward though, so I will work on it and will send a patch extended Peter's suggestion to all the cases. If run into issues/time constraints, then by EOW I'll send a simple fix with the designated initialized approach to fix the coverity report, while I continue on the "bonus" case.

Does that work?

Alejandro

#42 lore raw

Re: [PULL 016/106] intel_iommu_accel: Handle PASID entry addition for pc_inv_dsc request

In reply to Michael S. Tsirkin

Hi,

Quoted 36 lines · Michael S. Tsirkin

From: Zhenzhong Duan <[email protected]>

Structure VTDAddressSpace includes some elements suitable for emulated device and passthrough device without PASID, e.g., address space, different memory regions, etc, it is also protected by vtd iommu lock, all these are useless and become a burden for passthrough device with PASID.

When there are lots of PASIDs used in one device, the AS and MRs are all registered to memory core and impact the whole system performance.

So instead of using VTDAddressSpace to cache pasid entry for each pasid of a passthrough device, we define a light weight structure VTDAccelPASIDCacheEntry with only necessary elements for each pasid. We will use this struct as a parameter to conduct binding/unbinding to nested hwpt and to record the current bound nested hwpt. It's also designed to support IOMMU_NO_PASID.

VTDAccelPASIDCacheEntry is designed to only be used in intel_iommu_accel.c, similarly VTDPASIDCacheEntry should only be used in hw/i386/intel_iommu.c

When guest creates new PASID entries, QEMU will capture the pc_inv_dsc (pasid cache invalidation) request, walk through each pasid in each passthrough device for valid pasid entries, create a new VTDAccelPASIDCacheEntry if not existing yet.

IOMMU_NO_PASID of passthrough device still need to register MRs in case guest does not operate in scalable mode. So for IOMMU_NO_PASID, we have both VTDPASIDCacheEntry and VTDAccelPASIDCacheEntry.

Quoted 7 lines

Message-Id: <[email protected]>

---
  hw/i386/intel_iommu.c          |   3 +
  hw/i386/intel_iommu_accel.c    | 156 +++++++++++++++++++++++++++++++++
  hw/i386/intel_iommu_accel.h    |  13 +++
  hw/i386/intel_iommu_internal.h |   8 ++
  4 files changed, 180 insertions(+)

Michael, please setup scripts/git.orderfile ;)

Quoted 5 lines
hw/i386/intel_iommu_accel.h +0 -0
index e5f0b077b4..c9b1823745 100644

hw/i386/intel_iommu_accel.h line 20

Quoted 9 lines
hw/i386/intel_iommu_accel.h +6 -0
@@ -12,6 +12,13 @@
  #define HW_I386_INTEL_IOMMU_ACCEL_H
  #include CONFIG_DEVICES
 
+typedef struct VTDAccelPASIDCacheEntry {
+    VTDHostIOMMUDevice *vtd_hiod;
+    VTDPASIDEntry pasid_entry;
+    uint32_t pasid;
+    QLIST_ENTRY(VTDAccelPASIDCacheEntry) next;
+} VTDAccelPASIDCacheEntry;

Zhenzhong, this structure should be declared ...

hw/i386/intel_iommu_accel.h line 22

Quoted 1 line
hw/i386/intel_iommu_accel.h +0 -0
  #ifdef CONFIG_VTD_ACCEL

... after this guard.

Quoted 22 lines
hw/i386/intel_iommu_accel.h +6 -0
  bool vtd_check_hiod_accel(IntelIOMMUState *s, VTDHostIOMMUDevice *vtd_hiod,
                            Error **errp);
@@ -20,6 +27,7 @@ bool vtd_propagate_guest_pasid(VTDAddressSpace *vtd_as, Error **errp);
  void vtd_flush_host_piotlb_all_locked(IntelIOMMUState *s, uint16_t domain_id,
                                        uint32_t pasid, hwaddr addr,
                                        uint64_t npages, bool ih);
+void vtd_accel_pasid_cache_sync(IntelIOMMUState *s, VTDPASIDCacheInfo *pc_info);
  void vtd_iommu_ops_update_accel(PCIIOMMUOps *ops);
  #else
  static inline bool vtd_check_hiod_accel(IntelIOMMUState *s,
@@ -49,6 +57,11 @@ static inline void vtd_flush_host_piotlb_all_locked(IntelIOMMUState *s,
  {
  }
 
+static inline void vtd_accel_pasid_cache_sync(IntelIOMMUState *s,
+                                              VTDPASIDCacheInfo *pc_info)
+{
+}
+
  static inline void vtd_iommu_ops_update_accel(PCIIOMMUOps *ops)
  {
  }
#43 lore raw

RE: [PULL 016/106] intel_iommu_accel: Handle PASID entry addition for pc_inv_dsc request

Hi Philippe,

Quoted 9 lines

hw/i386/intel_iommu_accel.h line 20

Quoted 6 lines
hw/i386/intel_iommu_accel.h +6 -0
+typedef struct VTDAccelPASIDCacheEntry {
+    VTDHostIOMMUDevice *vtd_hiod;
+    VTDPASIDEntry pasid_entry;
+    uint32_t pasid;
+    QLIST_ENTRY(VTDAccelPASIDCacheEntry) next;
+} VTDAccelPASIDCacheEntry;

Zhenzhong, this structure should be declared ...

Quoted 3 lines
Quoted 1 line
  #ifdef CONFIG_VTD_ACCEL

... after this guard.

Indeed. It doesn’t impact build process, build pass with or without fix. I can send a fix together with PRQ v3 series if you will not send it.

Just curious, how do you catch this?:)

Thanks
Zhenzhong

#44 lore raw

Re: [PULL 016/106] intel_iommu_accel: Handle PASID entry addition for pc_inv_dsc request

Quoted 11 lines · Zhenzhong

Hi Philippe,

Quoted 9 lines

hw/i386/intel_iommu_accel.h line 20

Quoted 6 lines
hw/i386/intel_iommu_accel.h +6 -0
+typedef struct VTDAccelPASIDCacheEntry {
+    VTDHostIOMMUDevice *vtd_hiod;
+    VTDPASIDEntry pasid_entry;
+    uint32_t pasid;
+    QLIST_ENTRY(VTDAccelPASIDCacheEntry) next;
+} VTDAccelPASIDCacheEntry;

Zhenzhong, this structure should be declared ...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line
   #ifdef CONFIG_VTD_ACCEL

... after this guard.

Indeed. It doesn’t impact build process, build pass with or without fix.

I didn't complain about build failure in the main repository ;)

Quoted 3 lines

I can send a fix together with PRQ v3 series if you will not send it.

Just curious, how do you catch this?:)

Rebasing this patch:
https://lore.kernel.org/qemu-devel/[email protected]/