kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"eddie.dong@intel.com" <eddie.dong@intel.com>,
	pbonzini@redhat.com
Subject: Re: RFC: ioapic polarity vs. qemu os-x guest
Date: Sun, 16 Feb 2014 13:41:52 +0200	[thread overview]
Message-ID: <20140216114151.GB30056@redhat.com> (raw)
In-Reply-To: <2CEB9F8C-E983-4182-A514-44EC568E18D8@suse.de>

On Fri, Feb 14, 2014 at 11:13:04PM +0100, Alexander Graf wrote:
> 
> On 14.02.2014, at 23:06, Gabriel L. Somlo <gsomlo@gmail.com> wrote:
> 
> > On Fri, Feb 14, 2014 at 10:21:09PM +0100, Alexander Graf wrote:
> >> 
> >> Can't you just turn the polarity around in the pci host adapter?
> > 
> > I tried this:
> > 
> > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > index 1221f32..0e86d21 100644
> > --- a/hw/pci/pci.c
> > +++ b/hw/pci/pci.c
> > @@ -118,13 +118,13 @@ static int pci_bar(PCIDevice *d, int reg)
> > 
> > static inline int pci_irq_state(PCIDevice *d, int irq_num)
> > {
> > -	return (d->irq_state >> irq_num) & 0x1;
> > +	return !(d->irq_state >> irq_num) & 0x1;
> > }
> > 
> > static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level)
> > {
> > 	d->irq_state &= ~(0x1 << irq_num);
> > -	d->irq_state |= level << irq_num;
> > +	d->irq_state &= ~(level << irq_num);
> > }
> > 
> > static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change)
> > @@ -229,7 +229,7 @@ static void pcibus_reset(BusState *qbus)
> >     }
> > 
> >     for (i = 0; i < bus->nirq; i++) {
> > -        assert(bus->irq_count[i] == 0);
> > +        assert(bus->irq_count[i] != 0);
> >     }
> > }
> > 
> > ---
> > 
> > but now OS X freezes during boot right after
> > 
> > 	[ PCI configuration begin ]
> > 	[ PCI configuration end, bridges 1, devices 10 ]
> > 	RTC: Only single RAM bank (128 bytes)
> > 
> > which all looks normal, except the process is supposed to continue on
> > from there and doesn't :)
> > 
> > On Linux, I get Fedora 20 live all the way up with no obvious/loud
> > complaints, but mouse and keyboard don't work at all...
> > 
> > I have to admit I'm a bit out of my depth here, though :)
> 
> Yeah, another thing we have to take into account is vhost-net which generates IRQs directly through irqfd. I guess for those we'll have to configure the polarity in the irq routing table?
> 
> 
> Alex

What will be affected is VFIO which uses IRQFD
for level interrupts with KVM_IRQFD_FLAG_RESAMPLE.
I suspect this will need a kernel change, maybe
a new flag for IRQFD: KVM_IRQFD_FLAG_ACTIVE_LOW,
since at the moment that does:

static void
irqfd_inject(struct work_struct *work)
{
        struct _irqfd *irqfd = container_of(work, struct _irqfd, inject);
        struct kvm *kvm = irqfd->kvm;

        if (!irqfd->resampler) {
                kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 1,
                                false);
                kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 0,
                                false);
        } else
                kvm_set_irq(kvm, KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID,
                            irqfd->gsi, 1, false);
}



-- 
MST

  parent reply	other threads:[~2014-02-16 11:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140130204423.GK29329@ERROL.INI.CMU.EDU>
2014-02-11 18:23 ` RFC: ioapic polarity vs. qemu os-x guest Gabriel L. Somlo
2014-02-11 19:54   ` Michael S. Tsirkin
2014-02-11 21:35     ` Gabriel L. Somlo
2014-02-14 21:13     ` Gabriel L. Somlo
2014-02-14 21:21       ` Alexander Graf
2014-02-14 22:06         ` Gabriel L. Somlo
2014-02-14 22:13           ` Alexander Graf
2014-02-16 11:18             ` Michael S. Tsirkin
2014-02-16 11:41             ` Michael S. Tsirkin [this message]
2014-02-16 14:47               ` Alex Williamson
2014-02-16 16:23                 ` Michael S. Tsirkin
2014-02-17 17:57                   ` Gabriel L. Somlo
2014-02-17 18:01                     ` Gabriel L. Somlo
2014-02-17 18:06                       ` Paolo Bonzini
2014-02-17 19:38                         ` Gabriel L. Somlo
2014-02-18  0:58                           ` Gabriel L. Somlo
2014-02-27 17:05                   ` [PATCH RFC] kvm: ignore apic polarity Michael S. Tsirkin
2014-02-27 21:41                     ` Gabriel L. Somlo
2014-02-27 22:30                       ` Paolo Bonzini
2014-02-27 23:13                         ` Gabriel L. Somlo
2014-02-27 23:31                           ` Paolo Bonzini
2014-02-28  4:06                             ` [RFC PATCH v2] kvm: x86: ignore ioapic polarity Gabriel L. Somlo
2014-03-02 14:55                               ` Michael S. Tsirkin
2014-03-13 10:53                               ` Paolo Bonzini
2014-03-13 13:43                                 ` Gabriel L. Somlo
2014-02-28  4:55                         ` [PATCH RFC] kvm: ignore apic polarity Michael S. Tsirkin
2014-02-28  8:10                           ` Paolo Bonzini
2014-02-28  8:11                           ` Paolo Bonzini
2014-03-01  5:03                     ` Alex Williamson
2014-02-16 11:34       ` RFC: ioapic polarity vs. qemu os-x guest Michael S. Tsirkin
2014-02-16 15:12         ` [Qemu-devel] " Peter Maydell
2014-02-16 11:37       ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140216114151.GB30056@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=eddie.dong@intel.com \
    --cc=gsomlo@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).