Skip to content

Commit

Permalink
powerpc/powernv: Fix corrupted PE allocation bitmap on releasing PE
Browse files Browse the repository at this point in the history
In pnv_ioda_free_pe(), the PE object (including the associated PE
number) is cleared before resetting the corresponding bit in the
PE allocation bitmap. It means PE#0 is always released to the bitmap
wrongly.

This fixes above issue by caching the PE number before the PE object
is cleared.

Fixes: 1e91677 ("powerpc/powernv: Use PE instead of number during setup and release"
Cc: [email protected] # v4.7+
Signed-off-by: Gavin Shan <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
Gavin Shan authored and mpe committed Sep 8, 2016
1 parent b314427 commit caa58f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/powerpc/platforms/powernv/pci-ioda.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb)
static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe)
{
struct pnv_phb *phb = pe->phb;
unsigned int pe_num = pe->pe_number;

WARN_ON(pe->pdev);

memset(pe, 0, sizeof(struct pnv_ioda_pe));
clear_bit(pe->pe_number, phb->ioda.pe_alloc);
clear_bit(pe_num, phb->ioda.pe_alloc);
}

/* The default M64 BAR is shared by all PEs */
Expand Down

0 comments on commit caa58f8

Please sign in to comment.