Skip to contentSkip to conversation

spapr: Avoid some integer conversions in spapr_phb_realize()

PATCH Applied Greg Kurz 3 participants 5 messages Jul 28, 2020 – Jul 31, 2020

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

PATCH 1/1 spapr: Avoid some integer conversions in spapr_phb_realize()

Without this patch, the irq number gets converted uselessly from int to int32_t, back and forth.

This doesn't fix an actual issue, it's just to make the code neater.

---

This is a follow-up to my previous "spapr: Simplify error handling in spapr_phb_realize()" patch. Maybe worth squashing it there ?

---
 hw/ppc/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 59441e2117f3..0a418f1e6711 100644
@@ -1964,7 +1964,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
 
     /* Initialize the LSI table */
     for (i = 0; i < PCI_NUM_PINS; i++) {
-        int32_t irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
+        int irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
 
         if (smc->legacy_irq_allocation) {
             irq = spapr_irq_findone(spapr, errp);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Greg Kurz

Without this patch, the irq number gets converted uselessly from int to int32_t, back and forth.

This doesn't fix an actual issue, it's just to make the code neater.

---

This is a follow-up to my previous "spapr: Simplify error handling in spapr_phb_realize()" patch. Maybe worth squashing it there ?

---
 hw/ppc/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +0 -0
index 59441e2117f3..0a418f1e6711 100644

hw/ppc/spapr_pci.c static void spapr_phb_realize(DeviceState *dev, Error **errp) · line 1970

Quoted 8 lines
hw/ppc/spapr_pci.c +1 -1
@@ -1964,7 +1964,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
 
     /* Initialize the LSI table */
     for (i = 0; i < PCI_NUM_PINS; i++) {
-        int32_t irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
+        int irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
 
         if (smc->legacy_irq_allocation) {
             irq = spapr_irq_findone(spapr, errp);
Applied
#2 lore raw
In reply to Greg Kurz
Quoted 7 lines · Greg Kurz

Without this patch, the irq number gets converted uselessly from int to int32_t, back and forth.

This doesn't fix an actual issue, it's just to make the code neater.

Applied to ppc-for-5.2, thanks.

Quoted 23 lines

---

This is a follow-up to my previous "spapr: Simplify error handling in spapr_phb_realize()" patch. Maybe worth squashing it there ?

---
 hw/ppc/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 59441e2117f3..0a418f1e6711 100644
@@ -1964,7 +1964,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
 
     /* Initialize the LSI table */
     for (i = 0; i < PCI_NUM_PINS; i++) {
-        int32_t irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
+        int irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
 
         if (smc->legacy_irq_allocation) {
             irq = spapr_irq_findone(spapr, errp);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
author
#3 lore raw
Quoted 11 lines · On Wed, 29 Jul 2020 12:54:41 +1000 David Gibson <[email protected]>…
Quoted 7 lines · Greg Kurz

Without this patch, the irq number gets converted uselessly from int to int32_t, back and forth.

This doesn't fix an actual issue, it's just to make the code neater.

Applied to ppc-for-5.2, thanks.

Daniel reported a crash that happens systematically on some systems that don't support KVM XIVE (aka. bostons) since the patch "spapr: Simplify error handling in spapr_phb_realize()" landed in the ppc-for-5.2 tree.

The patch is good but it uncovered an issue we have in the KVM XIVE code in QEMU (basically we should ignore the absence of KVM XIVE device when claiming IRQ numbers).

The fix is trivial but to avoid breaking bisect, it should rather go before the patch mentioned above. Also I want to consolidate the error handling a bit more so, in the meantime, for others to be able to use the ppc-for-5.2 branch, I suggest you simply drop:

spapr: Simplify error handling in spapr_phb_realize()

and the current patch as well since it's a follow-up.

I'll send a new patchset later.

Quoted 24 lines
Quoted 23 lines

---

This is a follow-up to my previous "spapr: Simplify error handling in spapr_phb_realize()" patch. Maybe worth squashing it there ?

---
 hw/ppc/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_pci.c +1 -1
index 59441e2117f3..0a418f1e6711 100644
@@ -1964,7 +1964,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
 
     /* Initialize the LSI table */
     for (i = 0; i < PCI_NUM_PINS; i++) {
-        int32_t irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
+        int irq = SPAPR_IRQ_PCI_LSI + sphb->index * PCI_NUM_PINS + i;
 
         if (smc->legacy_irq_allocation) {
             irq = spapr_irq_findone(spapr, errp);
#4 lore raw
Quoted 28 lines · Greg Kurz
Quoted 11 lines · On Wed, 29 Jul 2020 12:54:41 +1000 David Gibson <[email protected]>…
Quoted 7 lines · Greg Kurz

Without this patch, the irq number gets converted uselessly from int to int32_t, back and forth.

This doesn't fix an actual issue, it's just to make the code neater.

Applied to ppc-for-5.2, thanks.

Daniel reported a crash that happens systematically on some systems that don't support KVM XIVE (aka. bostons) since the patch "spapr: Simplify error handling in spapr_phb_realize()" landed in the ppc-for-5.2 tree.

The patch is good but it uncovered an issue we have in the KVM XIVE code in QEMU (basically we should ignore the absence of KVM XIVE device when claiming IRQ numbers).

The fix is trivial but to avoid breaking bisect, it should rather go before the patch mentioned above. Also I want to consolidate the error handling a bit more so, in the meantime, for others to be able to use the ppc-for-5.2 branch, I suggest you simply drop:

Quoted 5 lines

spapr: Simplify error handling in spapr_phb_realize()

and the current patch as well since it's a follow-up.

I'll send a new patchset later.

Ok, done, I've removed both those patches from ppc-for-5.2, resend the new version whenever you're ready.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson