On Tue, Feb 11, 2014 at 09:54:44PM +0200, Michael S. Tsirkin wrote: > On Tue, Feb 11, 2014 at 01:23:31PM -0500, Gabriel L. Somlo wrote: > > I'm trying to get OS X to work as a QEMU guest, and one of the few > > remaining "mysteries" I need to solve is that the OS X guest hangs > > during boot, waiting for its boot disk to be available, unless the > > following KVM patch is applied: > > [...] > > 2. Is there anything in QEMU (besides the ACPI DSDT .dsl files) which > > has a hardcoded assumption re. "polarity == 0", or active-high, for > > level-triggered interrupts? I tried to dig through hw/i386/kvm/ioapic.c > > and a bunch of other files, but couldn't isolate anything that I could > > "flip" to fix things in userspace. > > > > > > Any ideas or suggestions about the appropriate way to move forward would > > be much appreciated !!! > > > > > > Thanks much, > > --Gabriel > > I think changing ACPI is the right thing to > do really. But we'll need to fix some things > first of course. > > I think it's PC Q35 that has this assumption. > hw/i386/pc_q35.c > > gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, > GSI_NUM_PINS); > > kvm_pc_gsi_handler simply forwards interrupts to kvm. > > and > > hw/isa/lpc_ich9.c > static void ich9_lpc_update_pic(ICH9LPCState *lpc, int pic_irq) > { > int i, pic_level; > > /* The pic level is the logical OR of all the PCI irqs mapped to it */ > /* The pic level is the logical OR of all the PCI irqs mapped to it > * */ > pic_level = 0; > for (i = 0; i < ICH9_LPC_NB_PIRQS; i++) { > int tmp_irq; > int tmp_dis; > ich9_lpc_pic_irq(lpc, i, &tmp_irq, &tmp_dis); > if (!tmp_dis && pic_irq == tmp_irq) { > pic_level |= pci_bus_get_irq_level(lpc->d.bus, i); > } > } > > so somewhere we need to flip it, I am guessing in ich9 > along the lines of: > > - pic_level = 0; > - pic_level |= pci_bus_get_irq_level(lpc->d.bus, i); > + pic_level = 1; > + pic_level &= !pci_bus_get_irq_level(lpc->d.bus, i); I think now we're on to something! I managed to boot OS X on q35 with absolutely no kernel patches, but Linux still hated it ("irqXX: nobody cared"). At least now I know what I'm looking for, so I'll try to come up with a way to flip level-triggered polarity to ActiveLow across all of i386, in a way that works for Linux and Windows guests as well. Thanks again for getting me unstuck! --Gabriel -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html