On Tue, 2024-07-02 at 05:17 +0000, Sandesh Patel wrote:
> 
> The error is due to invalid MSIX routing entry passed to KVM.
> 
> The VM boots fine if we attach a vIOMMU but adding a vIOMMU can
> potentially result in IO performance loss in guest.
> I was interested to know if someone could boot a large Windows VM by
> some other means like kvm-msi-ext-dest-id.

I think I may (with Alex Graf's suggestion) have found the Windows bug
with Intel IOMMU.

It looks like when interrupt remapping is enabled with an AMD CPU,
Windows *assumes* it can generate AMD-style MSI messages even if the
IOMMU is an Intel one. If we put a little hack into the IOMMU interrupt
remapping to make it interpret an AMD-style message, Windows seems to
boot at least a little bit further than it did before...


--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3550,9 +3550,14 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState 
*iommu,
 
     /* This is compatible mode. */
     if (addr.addr.int_mode != VTD_IR_INT_FORMAT_REMAP) {
-        memcpy(translated, origin, sizeof(*origin));
-        goto out;
-    }
+        if (0) {
+            memcpy(translated, origin, sizeof(*origin));
+            goto out;
+        }
+        /* Pretend it's an AMD-format remappable MSI (Yay Windows!) */
+        index = origin->data & 0x7ff;
+        printf("Compat mode index 0x%x\n", index);
+    } else
 
     index = addr.addr.index_h << 15 | addr.addr.index_l;
 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to