kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] fix irq routing by moving it to the correct place
@ 2009-05-06 14:11 Jes Sorensen
  2009-05-07  1:19 ` Zhang, Xiantao
  2009-05-07  9:35 ` Avi Kivity
  0 siblings, 2 replies; 4+ messages in thread
From: Jes Sorensen @ 2009-05-06 14:11 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Zhang, Xiantao, kvm-ia64@vger.kernel.org, kvm@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

Hi,

Some freak :-) put x86 specific irq routing into the generic code path,
which obviously won't work on non-x86 systems.

This patch creates kvm_arch_init_irq_routing() and moves the x86
gibberish to it's correct location :-)

Now I have networking again!

Cheers,
Jes


[-- Attachment #2: 0006-qemu-kvm-irq-routing.patch --]
[-- Type: text/x-patch, Size: 3276 bytes --]

Platform specific IRQ routing doesn't belong in the generic codepath.
Create kvm_arch_init_irq_routing() and move the x86 specific routing
setup to the appropriate place.

With this interrupts are delivered again on ia64.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 qemu-kvm-ia64.c |    4 ++++
 qemu-kvm-x86.c  |   30 ++++++++++++++++++++++++++++++
 qemu-kvm.c      |   23 ++---------------------
 qemu-kvm.h      |    2 ++
 4 files changed, 38 insertions(+), 21 deletions(-)

Index: qemu-kvm/qemu-kvm-ia64.c
===================================================================
--- qemu-kvm.orig/qemu-kvm-ia64.c
+++ qemu-kvm/qemu-kvm-ia64.c
@@ -144,3 +144,7 @@
     struct ioperm_data *data = _data;
     ioperm(data->start_port, data->num, data->turn_on);
 }
+
+void kvm_arch_init_irq_routing(void)
+{
+}
Index: qemu-kvm/qemu-kvm-x86.c
===================================================================
--- qemu-kvm.orig/qemu-kvm-x86.c
+++ qemu-kvm/qemu-kvm-x86.c
@@ -879,3 +879,33 @@
         return true;
     return false;
 }
+
+/*
+ * Setup x86 specific IRQ routing
+ */
+void kvm_arch_init_irq_routing(void)
+{
+    int i;
+
+    if (kvm_irqchip && kvm_has_gsi_routing(kvm_context)) {
+        kvm_clear_gsi_routes(kvm_context);
+        for (i = 0; i < 8; ++i) {
+            if (i == 2)
+                continue;
+            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_MASTER, i);
+            if (r < 0)
+                return r;
+        }
+        for (i = 8; i < 16; ++i) {
+            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
+            if (r < 0)
+                return r;
+        }
+        for (i = 0; i < 24; ++i) {
+            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
+            if (r < 0)
+                return r;
+        }
+        kvm_commit_irq_routes(kvm_context);
+    }
+}
Index: qemu-kvm/qemu-kvm.c
===================================================================
--- qemu-kvm.orig/qemu-kvm.c
+++ qemu-kvm/qemu-kvm.c
@@ -792,27 +792,8 @@
         }
     }
 
-    if (kvm_irqchip && kvm_has_gsi_routing(kvm_context)) {
-        kvm_clear_gsi_routes(kvm_context);
-        for (i = 0; i < 8; ++i) {
-            if (i == 2)
-                continue;
-            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_MASTER, i);
-            if (r < 0)
-                return r;
-        }
-        for (i = 8; i < 16; ++i) {
-            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
-            if (r < 0)
-                return r;
-        }
-        for (i = 0; i < 24; ++i) {
-            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
-            if (r < 0)
-                return r;
-        }
-        kvm_commit_irq_routes(kvm_context);
-    }
+    kvm_arch_init_irq_routing();
+
     return 0;
 }
 
Index: qemu-kvm/qemu-kvm.h
===================================================================
--- qemu-kvm.orig/qemu-kvm.h
+++ qemu-kvm/qemu-kvm.h
@@ -126,6 +126,8 @@
 int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
 int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
 
+void kvm_arch_init_irq_routing(void);
+
 #ifdef USE_KVM_DEVICE_ASSIGNMENT
 struct ioperm_data;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [patch] fix irq routing by moving it to the correct place
  2009-05-06 14:11 [patch] fix irq routing by moving it to the correct place Jes Sorensen
@ 2009-05-07  1:19 ` Zhang, Xiantao
  2009-05-07  9:35 ` Avi Kivity
  1 sibling, 0 replies; 4+ messages in thread
From: Zhang, Xiantao @ 2009-05-07  1:19 UTC (permalink / raw)
  To: Jes Sorensen, Avi Kivity; +Cc: kvm-ia64@vger.kernel.org, kvm@vger.kernel.org

Aha, good catch! I think it should fix irq routting for pci irq of ia64 ?
Xiantao 

-----Original Message-----
From: Jes Sorensen [mailto:jes@sgi.com] 
Sent: Wednesday, May 06, 2009 10:12 PM
To: Avi Kivity
Cc: Zhang, Xiantao; kvm-ia64@vger.kernel.org; kvm@vger.kernel.org
Subject: [patch] fix irq routing by moving it to the correct place

Hi,

Some freak :-) put x86 specific irq routing into the generic code path,
which obviously won't work on non-x86 systems.

This patch creates kvm_arch_init_irq_routing() and moves the x86
gibberish to it's correct location :-)

Now I have networking again!

Cheers,
Jes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] fix irq routing by moving it to the correct place
  2009-05-06 14:11 [patch] fix irq routing by moving it to the correct place Jes Sorensen
  2009-05-07  1:19 ` Zhang, Xiantao
@ 2009-05-07  9:35 ` Avi Kivity
  2009-05-07 11:44   ` Avi Kivity
  1 sibling, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2009-05-07  9:35 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Zhang, Xiantao, kvm-ia64@vger.kernel.org, kvm@vger.kernel.org

Jes Sorensen wrote:
> Hi,
>
> Some freak :-) put x86 specific irq routing into the generic code path,
> which obviously won't work on non-x86 systems.
>
> This patch creates kvm_arch_init_irq_routing() and moves the x86
> gibberish to it's correct location :-)
>

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] fix irq routing by moving it to the correct place
  2009-05-07  9:35 ` Avi Kivity
@ 2009-05-07 11:44   ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2009-05-07 11:44 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Zhang, Xiantao, kvm-ia64@vger.kernel.org, kvm@vger.kernel.org

Avi Kivity wrote:
> Jes Sorensen wrote:
>> Hi,
>>
>> Some freak :-) put x86 specific irq routing into the generic code path,
>> which obviously won't work on non-x86 systems.
>>
>> This patch creates kvm_arch_init_irq_routing() and moves the x86
>> gibberish to it's correct location :-)
>>
>
> Applied, thanks.
>

Argh, that didn't build on x86.  I fixed it up.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-07 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-06 14:11 [patch] fix irq routing by moving it to the correct place Jes Sorensen
2009-05-07  1:19 ` Zhang, Xiantao
2009-05-07  9:35 ` Avi Kivity
2009-05-07 11:44   ` Avi Kivity

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).