Skip to content

Commit

Permalink
[POWERPC] Add spinlock to request_phb_iospace()
Browse files Browse the repository at this point in the history
request_phb_iospace() can be called from different CPUs at init
time (at least with my next patch) and thus needs a spinlock.
As for the next patch, this is a temporary workaround for 2.6.22
issues until my rewrite of IO mappings is ready (for 2.6.23)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed May 17, 2007
1 parent 6a32d08 commit 017e3c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/mm/pgtable_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,19 @@ EXPORT_SYMBOL(__ioremap);
EXPORT_SYMBOL(iounmap);
EXPORT_SYMBOL(__iounmap);

static DEFINE_SPINLOCK(phb_io_lock);

void __iomem * reserve_phb_iospace(unsigned long size)
{
void __iomem *virt_addr;

if (phbs_io_bot >= IMALLOC_BASE)
panic("reserve_phb_iospace(): phb io space overflow\n");

spin_lock(&phb_io_lock);
virt_addr = (void __iomem *) phbs_io_bot;
phbs_io_bot += size;
spin_unlock(&phb_io_lock);

return virt_addr;
}

0 comments on commit 017e3c5

Please sign in to comment.