diff mbox series

[v3,6/6] hw/vmapple: XHCI controller's interrupt mapping workaround for macOS

Message ID 20241227121336.25838-7-phil@philjordan.eu (mailing list archive)
State New
Headers show
Series hw/usb/hcd-xhci: Fixes, improvements, and macOS workaround | expand

Commit Message

Phil Dennis-Jordan Dec. 27, 2024, 12:13 p.m. UTC
This change enables the new conditional interrupt mapping support
property on the vmapple machine type's integrated XHCI controller
using compat_props.

The macOS guest driver attempts to use event rings 1 and 2 on the XHCI
controller, despite there being only one (PCI pin) interrupt channel
available. With conditional interrupt mapping enabled, the XHCI
controller will only schedule events on interrupter 0 in PCI pin mode.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---

v2:

 * Set the "conditional-intr-mapping" property via compat_props, not
   directly on the created XHCI controller object.

v3:

 * Moved the compat global property table into vmapple patch set -v16,
   now just add the conditional-intr-mapping property to it.
 * Set the property on any device implementing the abstract TYPE_XHCI_PCI
   rather than only the TYPE_QEMU_XHCI device specifically. (So the
   NEC controller works with the vmapple machine type too.)

 hw/vmapple/vmapple.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/hw/vmapple/vmapple.c b/hw/vmapple/vmapple.c
index 41e3d7d189..ec0896dd32 100644
--- a/hw/vmapple/vmapple.c
+++ b/hw/vmapple/vmapple.c
@@ -38,7 +38,7 @@ 
 #include "hw/intc/arm_gicv3_common.h"
 #include "hw/misc/pvpanic.h"
 #include "hw/pci-host/gpex.h"
-#include "hw/usb/xhci.h"
+#include "hw/usb/hcd-xhci-pci.h"
 #include "hw/virtio/virtio-pci.h"
 #include "hw/vmapple/vmapple.h"
 #include "net/net.h"
@@ -562,6 +562,12 @@  static const CPUArchIdList *vmapple_possible_cpu_arch_ids(MachineState *ms)
 
 static GlobalProperty vmapple_compat_defaults[] = {
     { TYPE_VIRTIO_PCI, "disable-legacy", "on" },
+    /*
+     * macOS XHCI driver attempts to schedule events onto even rings 1 & 2
+     * even when (as here) there is no MSI(-X) support. Disabling interrupter
+     * mapping in the XHCI controller works around the problem.
+     */
+    { TYPE_XHCI_PCI, "conditional-intr-mapping", "on" },
 };
 
 static void vmapple_machine_class_init(ObjectClass *oc, void *data)