All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvm-ia64@vger.kernel.org
Subject: Re: [PATCH] kvm-ia64 irq assignment 1/2  kernel
Date: Mon, 09 Jun 2008 08:58:18 +0000	[thread overview]
Message-ID: <484CF0AA.7010302@suse.de> (raw)
In-Reply-To: <51CFAB8CB6883745AE7B93B3E084EBE201CC875F@pdsmsx412.ccr.corp.intel.com>

Avi Kivity wrote:
> Xu, Anthony wrote:
>> In kvm-ia64, we use the same guest firmware (GFW)as in Xen, GFW uses 
>> PRT to present PCI interrupt routing, all PCI devices'
>> interrupt pins
>> connect to IOAPIC, which doesn't match with kvm-ia64 Qemu PCI interrupt
>> routing.
>>
>> This patch modify Qemu PCI interupt routing code to match with GFW, 
>> Then PCI devices in qemu can work in kvm-ia64, for exmaple, NIC
>>
>>
>> Signed-off-by: Anthony Xu < anthony.xu@intel.com >
>>
>>
>> diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
>> index 99a1736..80c116c 100644
>> --- a/virt/kvm/ioapic.c
>> +++ b/virt/kvm/ioapic.c
>> @@ -272,7 +272,11 @@ void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic,
>> int irq, int level)
>>
>>         if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
>>                 entry = ioapic->redirtbl[irq];
>> -               level ^= entry.fields.polarity;
>> +// polarity of all devices in qemu is active high
>> +//  regardless of ioapic setting
>> +
>> +//             level ^= entry.fields.polarity;
>> +
>>   
>
> There are two errors in this patch:
>
> - kvm is not there just for qemu; it should be possible to use kvm 
> with some other userspace, which would assume that kvm correctly 
> emulates ioapic polarity
> - you are modifying shared code and so affect x86 as well

Apparently this is broken on x86 too. I was just trying this patch with 
Mac OS X as target and magically the in-kernel APIC starts working, so I 
guess something is going wrong already here.
Btw, according to the ACPI tables, all PCI interrupts are currently 
defined Active-Low.

Alex

>
> I suggest modifying the firmware to report the interrupts as active 
> high.  Since Xen does not emulate polarity, the change will not affect 
> it and the firmware can continue to be shared.  I'd also recommend 
> fixing Xen to emulate the polarity correctly, if possible.
>


WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Avi Kivity <avi@qumranet.com>
Cc: "Xu, Anthony" <anthony.xu@intel.com>, Jes Sorensen <jes@sgi.com>,
	kvm@vger.kernel.org, kvm-ia64@vger.kernel.org
Subject: Re: [PATCH] kvm-ia64 irq assignment 1/2  kernel
Date: Mon, 09 Jun 2008 10:58:18 +0200	[thread overview]
Message-ID: <484CF0AA.7010302@suse.de> (raw)
In-Reply-To: <484996EE.8060600@qumranet.com>

Avi Kivity wrote:
> Xu, Anthony wrote:
>> In kvm-ia64, we use the same guest firmware (GFW)as in Xen, GFW uses 
>> PRT to present PCI interrupt routing, all PCI devices'
>> interrupt pins
>> connect to IOAPIC, which doesn't match with kvm-ia64 Qemu PCI interrupt
>> routing.
>>
>> This patch modify Qemu PCI interupt routing code to match with GFW, 
>> Then PCI devices in qemu can work in kvm-ia64, for exmaple, NIC
>>
>>
>> Signed-off-by: Anthony Xu < anthony.xu@intel.com >
>>
>>
>> diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
>> index 99a1736..80c116c 100644
>> --- a/virt/kvm/ioapic.c
>> +++ b/virt/kvm/ioapic.c
>> @@ -272,7 +272,11 @@ void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic,
>> int irq, int level)
>>
>>         if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
>>                 entry = ioapic->redirtbl[irq];
>> -               level ^= entry.fields.polarity;
>> +// polarity of all devices in qemu is active high
>> +//  regardless of ioapic setting
>> +
>> +//             level ^= entry.fields.polarity;
>> +
>>   
>
> There are two errors in this patch:
>
> - kvm is not there just for qemu; it should be possible to use kvm 
> with some other userspace, which would assume that kvm correctly 
> emulates ioapic polarity
> - you are modifying shared code and so affect x86 as well

Apparently this is broken on x86 too. I was just trying this patch with 
Mac OS X as target and magically the in-kernel APIC starts working, so I 
guess something is going wrong already here.
Btw, according to the ACPI tables, all PCI interrupts are currently 
defined Active-Low.

Alex

>
> I suggest modifying the firmware to report the interrupts as active 
> high.  Since Xen does not emulate polarity, the change will not affect 
> it and the firmware can continue to be shared.  I'd also recommend 
> fixing Xen to emulate the polarity correctly, if possible.
>


  parent reply	other threads:[~2008-06-09  8:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 15:58 [PATCH] kvm-ia64 irq assignment 1/2 kernel Xu, Anthony
2008-06-06 15:58 ` Xu, Anthony
2008-06-06 19:58 ` Avi Kivity
2008-06-06 19:58   ` Avi Kivity
2008-06-09  8:58 ` Alexander Graf [this message]
2008-06-09  8:58   ` Alexander Graf
2008-06-09  9:16 ` Alexander Graf
2008-06-09  9:16   ` Alexander Graf
2008-06-10  6:33 ` Xu, Anthony
2008-06-10  6:33   ` Xu, Anthony
2008-06-10  7:25 ` Alexander Graf
2008-06-10  7:25   ` Alexander Graf
2008-06-12 12:24 ` Avi Kivity
2008-06-12 12:24   ` Avi Kivity
2008-06-12 12:30 ` Avi Kivity
2008-06-12 12:30   ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-06-10  7:57 [RFC]RE: " Xu, Anthony
2008-06-10  7:57 ` Xu, Anthony
2008-06-11 14:24 ` Alexander Graf
2008-06-11 14:24   ` Alexander Graf
2008-06-11 16:02 ` Marcelo Tosatti
2008-06-11 16:02   ` Marcelo Tosatti
2008-06-11 16:16 ` Marcelo Tosatti
2008-06-11 16:16   ` Marcelo Tosatti
2008-06-12 12:34 ` Avi Kivity
2008-06-12 12:34   ` Avi Kivity
2008-06-12 16:08 ` Xu, Anthony
2008-06-12 16:08   ` Xu, Anthony
2008-06-12 16:15 ` Xu, Anthony
2008-06-12 16:15   ` Xu, Anthony
2008-06-12 16:19 ` Xu, Anthony
2008-06-12 16:19   ` Xu, Anthony
2008-06-12 16:20 ` Xu, Anthony
2008-06-12 16:20   ` Xu, Anthony
2008-06-14 22:58 ` Marcelo Tosatti
2008-06-14 22:58   ` Marcelo Tosatti
2008-06-16  1:13 ` Xu, Anthony
2008-06-16  1:13   ` Xu, Anthony
2008-07-02  9:11 ` Jes Sorensen
2008-07-02  9:11   ` Jes Sorensen
2008-07-03  1:22 ` Xu, Anthony
2008-07-03  1:22   ` Xu, Anthony

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=484CF0AA.7010302@suse.de \
    --to=agraf@suse.de \
    --cc=kvm-ia64@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.