Skip to content

Commit b79331a

Browse files
ruscurmpe
authored andcommitted
powerpc/powernv/pci: Fix m64 checks for SR-IOV and window alignment
Commit 5958d19 checks for prefetchable m64 BARs by comparing the addresses instead of using resource flags. This broke SR-IOV as the m64 check in pnv_pci_ioda_fixup_iov_resources() fails. The condition in pnv_pci_window_alignment() also changed to checking only IORESOURCE_MEM_64 instead of both IORESOURCE_MEM_64 and IORESOURCE_PREFETCH. Revert these cases to the previous behaviour, adding a new helper function to do so. This is named pnv_pci_is_m64_flags() to make it clear this function is only looking at resource flags and should not be relied on for non-SRIOV resources. Fixes: 5958d19 ("Fix incorrect PE reservation attempt on some 64-bit BARs") Reported-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Russell Currey <[email protected]> Tested-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent ed7d9a1 commit b79331a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ static inline bool pnv_pci_is_m64(struct pnv_phb *phb, struct resource *r)
124124
r->start < (phb->ioda.m64_base + phb->ioda.m64_size));
125125
}
126126

127+
static inline bool pnv_pci_is_m64_flags(unsigned long resource_flags)
128+
{
129+
unsigned long flags = (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH);
130+
131+
return (resource_flags & flags) == flags;
132+
}
133+
127134
static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no)
128135
{
129136
phb->ioda.pe_array[pe_no].phb = phb;
@@ -2871,7 +2878,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)
28712878
res = &pdev->resource[i + PCI_IOV_RESOURCES];
28722879
if (!res->flags || res->parent)
28732880
continue;
2874-
if (!pnv_pci_is_m64(phb, res)) {
2881+
if (!pnv_pci_is_m64_flags(res->flags)) {
28752882
dev_warn(&pdev->dev, "Don't support SR-IOV with"
28762883
" non M64 VF BAR%d: %pR. \n",
28772884
i, res);
@@ -3096,7 +3103,7 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
30963103
* alignment for any 64-bit resource, PCIe doesn't care and
30973104
* bridges only do 64-bit prefetchable anyway.
30983105
*/
3099-
if (phb->ioda.m64_segsize && (type & IORESOURCE_MEM_64))
3106+
if (phb->ioda.m64_segsize && pnv_pci_is_m64_flags(type))
31003107
return phb->ioda.m64_segsize;
31013108
if (type & IORESOURCE_MEM)
31023109
return phb->ioda.m32_segsize;

0 commit comments

Comments
 (0)