Skip to contentSkip to conversation

powerpc: Add spinlock to request_phb_iospace()

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages May 15, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 powerpc: Add spinlock to request_phb_iospace()

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)

 arch/powerpc/mm/pgtable_64.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/mm/pgtable_64.c +4 -0
Index: linux-cell/arch/powerpc/mm/pgtable_64.c
===================================================================
@@ -322,6 +322,8 @@ 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;
@@ -329,8 +331,10 @@ void __iomem * reserve_phb_iospace(unsig
 	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;
 }
#1 lore raw
Quoted 5 lines · On Tue, 15 May 2007 14:16:26 +1000 Benjamin Herrenschmidt…

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)

What problem is this solving?

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/

#2 lore raw
Quoted 8 lines · Stephen Rothwell
Quoted 5 lines · On Tue, 15 May 2007 14:16:26 +1000 Benjamin Herrenschmidt…

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)

What problem is this solving?

See the description of the next patch.

Ben.