Skip to contentSkip to conversation

qemu-kvm-x86: consider the irq0override flag in kvm_arch_init_irq_routing

PATCH Applied Bernhard Kohl 3 participants 6 messages Sep 14, 2010 – Feb 7, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-kvm-x86: consider the irq0override flag in kvm_arch_init_irq_routing

The setting of the irq0override flag must be also passed properly to the KVM_IRQCHIP_IOAPIC.

---
 qemu-kvm-x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-kvm-x86.c +2 -2
index fd974b3..e35c234 100644
@@ -1388,9 +1388,9 @@ int kvm_arch_init_irq_routing(void)
             }
         }
         for (i = 0; i < 24; ++i) {
-            if (i == 0) {
+            if (i == 0 && irq0override) {
                 r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2);
-            } else if (i != 2) {
+            } else if (i != 2 || !irq0override) {
                 r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
             }
             if (r < 0) {
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 7 lines · Bernhard Kohl

The setting of the irq0override flag must be also passed properly to the KVM_IRQCHIP_IOAPIC.

---
 qemu-kvm-x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

#2 lore raw
In reply to Bernhard Kohl

Hi Bernhard,

Quoted 14 lines · Bernhard Kohl

The setting of the irq0override flag must be also passed properly to the KVM_IRQCHIP_IOAPIC.

---
 qemu-kvm-x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-kvm-x86.c +0 -0
index fd974b3..e35c234 100644
@@ -1388,9 +1388,9 @@ int kvm_arch_init_irq_routing(void)
             }

qemu-kvm-x86.c int kvm_arch_init_irq_routing(void) · line 1396

Quoted 10 lines
qemu-kvm-x86.c +2 -2
         }
         for (i = 0; i < 24; ++i) {
-            if (i == 0) {
+            if (i == 0 && irq0override) {
                 r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2);
-            } else if (i != 2) {
+            } else if (i != 2 || !irq0override) {
                 r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
             }
             if (r < 0) {

While cleaning up the irq0override fragments, I stumbled over this commit. It is a nop for qemu-kvm, today and also by the time it was applied:

irq0override = !kvm_irqchip || kvm_has_gsi_routing

But, for obvious reasons, the code above is only executed when gsi routing is available.

Can you remember what motivated this patch?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 31 lines · Jan Kiszka

Hi Bernhard,

Quoted 14 lines · Bernhard Kohl

The setting of the irq0override flag must be also passed properly to the KVM_IRQCHIP_IOAPIC.

---
 qemu-kvm-x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-kvm-x86.c +0 -0
index fd974b3..e35c234 100644
@@ -1388,9 +1388,9 @@ int kvm_arch_init_irq_routing(void)
             }

qemu-kvm-x86.c int kvm_arch_init_irq_routing(void) · line 1396

Quoted 10 lines
qemu-kvm-x86.c +2 -2
         }
         for (i = 0; i < 24; ++i) {
-            if (i == 0) {
+            if (i == 0 && irq0override) {
                 r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2);
-            } else if (i != 2) {
+            } else if (i != 2 || !irq0override) {
                 r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
             }
             if (r < 0) {

While cleaning up the irq0override fragments, I stumbled over this commit. It is a nop for qemu-kvm, today and also by the time it was applied:

Quoted 8 lines

irq0override = !kvm_irqchip || kvm_has_gsi_routing

But, for obvious reasons, the code above is only executed when gsi routing is available.

Can you remember what motivated this patch?

Jan

Guest OS which can't cope with 0->2 GSI->IOAPIC pin mapping.

#5 lore raw
In reply to Bernhard Kohl
Quoted 36 lines · Bernhard Kohl

Am 07.02.2011 10:42, schrieb ext Jan Kiszka:

Quoted 35 lines

Hi Bernhard,

Quoted 14 lines · Bernhard Kohl

The setting of the irq0override flag must be also passed properly to the KVM_IRQCHIP_IOAPIC.

---
  qemu-kvm-x86.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
qemu-kvm-x86.c +0 -0
index fd974b3..e35c234 100644
@@ -1388,9 +1388,9 @@ int kvm_arch_init_irq_routing(void)
              }

qemu-kvm-x86.c int kvm_arch_init_irq_routing(void) · line 1396

Quoted 10 lines
qemu-kvm-x86.c +2 -2
          }
          for (i = 0; i<  24; ++i) {
-            if (i == 0) {
+            if (i == 0&&  irq0override) {
                  r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2);
-            } else if (i != 2) {
+            } else if (i != 2 || !irq0override) {
                  r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
              }
              if (r<  0) {

While cleaning up the irq0override fragments, I stumbled over this commit. It is a nop for qemu-kvm, today and also by the time it was applied:

irq0override = !kvm_irqchip || kvm_has_gsi_routing

But, for obvious reasons, the code above is only executed when gsi routing is available.

Quoted 8 lines
Quoted 4 lines

Can you remember what motivated this patch?

Jan

For our legacy OS which only could handle the timer interrupt at irq 0, I set in qemu "irq0override=0;". In fact I added temporarily a command line option for that. Of course this setting needed to be passed to kvm.

As I already suspected: private changes... :)

Quoted 3 lines

Today we have a correction in our OS and can use qemu-kvm's default setting.

So I'm going to file a revert. Or does anyone feel strong about making this configurable?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#4 lore raw
In reply to Jan Kiszka

Am 07.02.2011 10:42, schrieb ext Jan Kiszka:

Quoted 30 lines

Hi Bernhard,

Quoted 14 lines · Bernhard Kohl

The setting of the irq0override flag must be also passed properly to the KVM_IRQCHIP_IOAPIC.

---
  qemu-kvm-x86.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
qemu-kvm-x86.c +0 -0
index fd974b3..e35c234 100644
@@ -1388,9 +1388,9 @@ int kvm_arch_init_irq_routing(void)
              }

qemu-kvm-x86.c int kvm_arch_init_irq_routing(void) · line 1396

Quoted 10 lines
qemu-kvm-x86.c +2 -2
          }
          for (i = 0; i<  24; ++i) {
-            if (i == 0) {
+            if (i == 0&&  irq0override) {
                  r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, 2);
-            } else if (i != 2) {
+            } else if (i != 2 || !irq0override) {
                  r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
              }
              if (r<  0) {

While cleaning up the irq0override fragments, I stumbled over this commit. It is a nop for qemu-kvm, today and also by the time it was applied:

Quoted 9 lines

irq0override = !kvm_irqchip || kvm_has_gsi_routing

But, for obvious reasons, the code above is only executed when gsi routing is available.

Can you remember what motivated this patch?

Jan

For our legacy OS which only could handle the timer interrupt at irq 0, I set in qemu "irq0override=0;". In fact I added temporarily a command line option for that. Of course this setting needed to be passed to kvm.

Today we have a correction in our OS and can use qemu-kvm's default setting.

Bernhard