From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH RFC] kvm: ignore apic polarity Date: Fri, 28 Feb 2014 22:03:59 -0700 Message-ID: <1393650239.2895.14.camel@ul30vt.home> References: <20140130204423.GK29329@ERROL.INI.CMU.EDU> <20140211182330.GC29329@ERROL.INI.CMU.EDU> <20140211195444.GB10951@redhat.com> <20140214211311.GH29329@ERROL.INI.CMU.EDU> <20140214220600.GI29329@ERROL.INI.CMU.EDU> <2CEB9F8C-E983-4182-A514-44EC568E18D8@suse.de> <20140216114151.GB30056@redhat.com> <1392562020.15608.437.camel@ul30vt.home> <20140216162300.GI30056@redhat.com> <20140227170549.GA23037@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" , "eddie.dong@intel.com" , Alexander Graf , "qemu-devel@nongnu.org" , "Gabriel L. Somlo" , pbonzini@redhat.com To: "Michael S. Tsirkin" Return-path: In-Reply-To: <20140227170549.GA23037@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On Thu, 2014-02-27 at 19:05 +0200, Michael S. Tsirkin wrote: > apic polarity in KVM does not work: too many things assume active high. > Let's not pretend it works, let's just ignore polarity flag. If we ever > want to emulate it exactly, this will need a feature flag anyway. > > Also report this to userspace: this makes it > possible to report the interrupt active-low > in ACPI, this way we are closer to real hardware. > > This patch fixes OSX running on KVM. > > Reported-by: "Gabriel L. Somlo" > Signed-off-by: Michael S. Tsirkin > > --- > > Gabriel, could you confirm this fixes OSX for you? > If you can play with linux tweaking interrupt > to active low, that would be very nice too: > it's weekend here. > > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index 902f124..db29b27 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -674,6 +676,7 @@ struct kvm_ppc_smmu_info { > #define KVM_CAP_ARM_EL1_32BIT 93 > #define KVM_CAP_SPAPR_MULTITCE 94 > #define KVM_CAP_EXT_EMUL_CPUID 95 > +#define KVM_CAP_X86_IOAPIC_POLARITY_IGNORED 96 > > #ifdef KVM_CAP_IRQ_ROUTING > > diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c > index 2d68297..ad170b4 100644 > --- a/virt/kvm/ioapic.c > +++ b/virt/kvm/ioapic.c > @@ -328,7 +328,6 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id, > irq_level = __kvm_irq_line_state(&ioapic->irq_states[irq], > irq_source_id, level); > entry = ioapic->redirtbl[irq]; > - irq_level ^= entry.fields.polarity; > if (!irq_level) { > ioapic->irr &= ~mask; > ret = 1; I've run Windows and Linux guests with vfio assigned devices with this change and all the interrupt types seem to work. Tested-by: Alex Williamson