Skip to contentSkip to conversation

ppc/pnv: Fix number of registers in the PCIe controller on POWER9

PATCH In review Frederic Barrat 3 participants 3 messages Apr 1, 2022 – Apr 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc/pnv: Fix number of registers in the PCIe controller on POWER9

The spec defines 3 registers, even though only index 0 and 2 are valid on POWER9. The same model is used on POWER10. Register 1 is defined there but we currently don't use it in skiboot. So we can keep reporting an error on write.

Reported by Coverity (CID 1487176).

Fixes 4f9924c4d4cf ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")
---
 include/hw/pci-host/pnv_phb4.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/pci-host/pnv_phb4.h +1 -1
index b02ecdceaa..19dcbd6f87 100644
@@ -180,7 +180,7 @@ struct PnvPhb4PecState {
     MemoryRegion nest_regs_mr;
 
     /* PCI registers, excluding per-stack */
-#define PHB4_PEC_PCI_REGS_COUNT     0x2
+#define PHB4_PEC_PCI_REGS_COUNT     0x3
     uint64_t pci_regs[PHB4_PEC_PCI_REGS_COUNT];
     MemoryRegion pci_regs_mr;
 
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Frederic Barrat

The spec defines 3 registers, even though only index 0 and 2 are valid on POWER9. The same model is used on POWER10. Register 1 is defined there but we currently don't use it in skiboot. So we can keep reporting an error on write.

Reported by Coverity (CID 1487176).

Fixes 4f9924c4d4cf ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")

---

Quoted 16 lines
  include/hw/pci-host/pnv_phb4.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/pci-host/pnv_phb4.h +1 -1
index b02ecdceaa..19dcbd6f87 100644
@@ -180,7 +180,7 @@ struct PnvPhb4PecState {
      MemoryRegion nest_regs_mr;
 
      /* PCI registers, excluding per-stack */
-#define PHB4_PEC_PCI_REGS_COUNT     0x2
+#define PHB4_PEC_PCI_REGS_COUNT     0x3
      uint64_t pci_regs[PHB4_PEC_PCI_REGS_COUNT];
      MemoryRegion pci_regs_mr;
 
#2 lore raw
In reply to Frederic Barrat
Quoted 5 lines · Frederic Barrat

The spec defines 3 registers, even though only index 0 and 2 are valid on POWER9. The same model is used on POWER10. Register 1 is defined there but we currently don't use it in skiboot. So we can keep reporting an error on write.

Quoted 8 lines

Reported by Coverity (CID 1487176).

Fixes 4f9924c4d4cf ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")
---
  include/hw/pci-host/pnv_phb4.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Queued for ppc-7.0

Thanks,

C.

Quoted 14 lines
include/hw/pci-host/pnv_phb4.h +1 -1
index b02ecdceaa..19dcbd6f87 100644
@@ -180,7 +180,7 @@ struct PnvPhb4PecState {
      MemoryRegion nest_regs_mr;
 
      /* PCI registers, excluding per-stack */
-#define PHB4_PEC_PCI_REGS_COUNT     0x2
+#define PHB4_PEC_PCI_REGS_COUNT     0x3
      uint64_t pci_regs[PHB4_PEC_PCI_REGS_COUNT];
      MemoryRegion pci_regs_mr;