Skip to contentSkip to conversation

hw/i386/kvm/ioapic: Replace magic '24' value by proper definition

PATCH In review Philippe Mathieu-Daudé 2 participants 4 messages Feb 9, 2024 – Feb 14, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/i386/kvm/ioapic: Replace magic '24' value by proper definition

Replace '24' -> KVM_IOAPIC_NUM_PINS.

---
 hw/i386/kvm/ioapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/kvm/ioapic.c +1 -1
index 409d0c8c76..b96fe84eed 100644
@@ -35,7 +35,7 @@ void kvm_pc_setup_irq_routing(bool pci_enabled)
         kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
     }
     if (pci_enabled) {
-        for (i = 0; i < 24; ++i) {
+        for (i = 0; i < KVM_IOAPIC_NUM_PINS; ++i) {
             if (i == 0) {
                 kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
             } else if (i != 2) {
Signature · 1 line
2.41.0
#1 lore raw

09.02.2024 22:01, Philippe Mathieu-Daudé:

Quoted 12 lines

Replace '24' -> KVM_IOAPIC_NUM_PINS.

---
  hw/i386/kvm/ioapic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/kvm/ioapic.c +0 -0
index 409d0c8c76..b96fe84eed 100644

hw/i386/kvm/ioapic.c void kvm_pc_setup_irq_routing(bool pci_enabled) · line 41

Quoted 8 lines
hw/i386/kvm/ioapic.c +1 -1
@@ -35,7 +35,7 @@ void kvm_pc_setup_irq_routing(bool pci_enabled)
          kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
      }
      if (pci_enabled) {
-        for (i = 0; i < 24; ++i) {
+        for (i = 0; i < KVM_IOAPIC_NUM_PINS; ++i) {
              if (i == 0) {
                  kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
              } else if (i != 2) {

There seems to be some confusion here about
KVM_IOAPIC_NUM_PINS vs IOAPIC_NUM_PINS (and
vs ICH9_LPC_IOAPIC_NUM_PINS).

FWIW.

/mjt

#2 lore raw
Quoted 17 lines · Michael Tokarev

09.02.2024 22:01, Philippe Mathieu-Daudé:

Quoted 16 lines

Replace '24' -> KVM_IOAPIC_NUM_PINS.

---
  hw/i386/kvm/ioapic.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/kvm/ioapic.c +0 -1
index 409d0c8c76..b96fe84eed 100644
@@ -35,7 +35,7 @@ void kvm_pc_setup_irq_routing(bool pci_enabled)
           kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
       }
       if (pci_enabled) {
-        for (i = 0; i < 24; ++i) {
Quoted 8 lines

hw/i386/kvm/ioapic.c void kvm_pc_setup_irq_routing(bool pci_enabled) · line 41

Quoted 4 lines
hw/i386/kvm/ioapic.c +1 -0
+        for (i = 0; i < KVM_IOAPIC_NUM_PINS; ++i) {
               if (i == 0) {
                   kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
               } else if (i != 2) {

There seems to be some confusion here about
KVM_IOAPIC_NUM_PINS vs IOAPIC_NUM_PINS (and
vs ICH9_LPC_IOAPIC_NUM_PINS).

Well this is what I'm trying to clear, isn't it?

KVM irqchip has a hard limit. ICH9_LPC_IOAPIC_NUM_PINS is specified in the ICH9 datasheet. It is unclear to me what IOAPIC_NUM_PINS represents, I suppose it emerged from the evolution of the Frankenstein PC machine to Q35.

#3 lore raw
In reply to Philippe Mathieu-Daudé

09.02.2024 22:01, Philippe Mathieu-Daudé:

Quoted 1 line

Replace '24' -> KVM_IOAPIC_NUM_PINS.

Picked up for trivial-patches. Not exactly a trivial thing but heck :)

Thanks,

/mjt

Quoted 18 lines
---
  hw/i386/kvm/ioapic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/kvm/ioapic.c +1 -1
index 409d0c8c76..b96fe84eed 100644
@@ -35,7 +35,7 @@ void kvm_pc_setup_irq_routing(bool pci_enabled)
          kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
      }
      if (pci_enabled) {
-        for (i = 0; i < 24; ++i) {
+        for (i = 0; i < KVM_IOAPIC_NUM_PINS; ++i) {
              if (i == 0) {
                  kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
              } else if (i != 2) {