diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2016-09-06 00:17:18 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-09-07 23:12:52 -0400 |
commit | caa58f808834fca9a4443233fd09df5ab639690d (patch) | |
tree | 2efb3435c952cabf2ac784b8406aacd152b54f61 | |
parent | b314427a52fd8daa1215d30e56de01e32edec531 (diff) |
powerpc/powernv: Fix corrupted PE allocation bitmap on releasing PE
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: 1e9167726c41 ("powerpc/powernv: Use PE instead of number during setup and release"
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 18f6fd1d0405..c16d790808f1 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -162,11 +162,12 @@ static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb) | |||
162 | static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) | 162 | static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) |
163 | { | 163 | { |
164 | struct pnv_phb *phb = pe->phb; | 164 | struct pnv_phb *phb = pe->phb; |
165 | unsigned int pe_num = pe->pe_number; | ||
165 | 166 | ||
166 | WARN_ON(pe->pdev); | 167 | WARN_ON(pe->pdev); |
167 | 168 | ||
168 | memset(pe, 0, sizeof(struct pnv_ioda_pe)); | 169 | memset(pe, 0, sizeof(struct pnv_ioda_pe)); |
169 | clear_bit(pe->pe_number, phb->ioda.pe_alloc); | 170 | clear_bit(pe_num, phb->ioda.pe_alloc); |
170 | } | 171 | } |
171 | 172 | ||
172 | /* The default M64 BAR is shared by all PEs */ | 173 | /* The default M64 BAR is shared by all PEs */ |