<html><body>
<p>The following is an updated version based on Dave's suggestion. <br>
<br>
Paul, This patch was tested on a Power 5 partition running redhat 4 (kernel src level 584). Please send it to<br>
mainline if there are no objections.<br>
<br>
This patch was originally created to fix the prolem that was found in PCI Hot Plug testing on redhat 4.  The problem was <br>
that rtas config-connector call failed because RedHat actively disabled access to  /dev/mem ( for security/selinux reasons). <br>
Disabling access to /dev/mem prevents  the RTAS pages from being mmaped. So we have to mark the RTAS pages as <br>
PG_reserved to allow mmap to pass.<br>
<br>
Paul already verified my previous version.  He will review  this one and push it  to mainline, if it is acceptable.<br>
<br>
<br>
-Linda<br>
<br>
diff -purN linux-2.6.8/arch/ppc64/mm/init.c linux-2.6.8-linda/arch/ppc64/mm/init.c<br>
--- linux-2.6.8/arch/ppc64/mm/init.c    1970-05-10 22:51:47.153000776 -0400<br>
+++ linux-2.6.8-linda/arch/ppc64/mm/init.c      1970-05-10 23:36:33.774957608 -0400<br>
@@ -706,7 +706,7 @@ void __init mem_init(void)<br>
        int nid;<br>
 #endif<br>
        pg_data_t *pgdat;<br>
-       unsigned long i;<br>
+       unsigned long i, pfn, start_pfn, end_pfn;<br>
        struct page *page;<br>
        unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;<br>
 <br>
@@ -749,8 +749,22 @@ void __init mem_init(void)<br>
                bsssize &gt;&gt; 10,<br>
                initsize &gt;&gt; 10);<br>
 <br>
+       /* Mark the RTAS pages as PG_reserved */<br>
+       start_pfn = rtas_rmo_buf &gt;&gt; PAGE_SHIFT;<br>
+       end_pfn = (rtas_rmo_buf + RTAS_RMOBUF_MAX) &gt;&gt;  PAGE_SHIFT;<br>
+       for (pfn = start_pfn; pfn &lt; end_pfn; pfn++) {<br>
+                       SetPageReserved(pfn_to_page(pfn));<br>
+       }<br>
+<br>
        mem_init_done = 1;<br>
 <br>
+<br>
 #ifdef CONFIG_PPC_ISERIES<br>
        iommu_vio_init();<br>
 #endif<br>
<br>
Signed-off-by: Linda Xie &lt;lxie@us.ibm.com&gt;<br>
<br>
<br>
<img src="cid:10__=08BBE58CDFB5CA4F8f9e8a93df938@us.ibm.com" width="16" height="16" alt="Inactive hide details for haveblue@us.ltcfwd.linux.ibm.com">haveblue@us.ltcfwd.linux.ibm.com<br>
<br>
<br>

<table V5DOTBL=true width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img src="cid:20__=08BBE58CDFB5CA4F8f9e8a93df938@us.ibm.com" border="0" height="1" width="72" alt=""><br>
</td><td style="background-image:url(cid:30__=08BBE58CDFB5CA4F8f9e8a93df938@us.ibm.com); background-repeat: no-repeat; " width="1%"><img src="cid:20__=08BBE58CDFB5CA4F8f9e8a93df938@us.ibm.com" border="0" height="1" width="225" alt=""><br>

<ul>
<ul>
<ul>
<ul><b><font size="2">haveblue@us.ltcfwd.linux.ibm.com</font></b>
<p><font size="2">09/29/2004 01:12 PM</font></ul>
</ul>
</ul>
</ul>
</td><td width="100%"><img src="cid:20__=08BBE58CDFB5CA4F8f9e8a93df938@us.ibm.com" border="0" height="1" width="1" alt=""><br>
<font size="1" face="Arial">        </font><br>
<font size="2">        To:        </font><font size="2">Linda Xie/Austin/IBM@IBMUS</font><br>
<font size="2">        cc:        </font><font size="2">Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;, John Rose &lt;johnrose@austin.ibm.com&gt;, linuxppc64-dev@ozlabs.org, Michael W Wortman/Austin/IBM@IBMUS</font><br>
<font size="2">        Subject:        </font><font size="2">Re: Fw: when to mark reserved low memory pages</font></td></tr>
</table>
<br>
<br>
<tt>On Wed, 2004-09-29 at 09:26, Linda Xie wrote:<br>
&gt; Here is my final patch which will be submitted to redhat.<br>
<br>
Might be nicer to do something like this instead of a whole bunch of<br>
__va() operations. &nbsp;page_to_pfn() is slightly lighter-weight than<br>
virt_to_page() (doesn't really matter at init-time, though). &nbsp;<br>
<br>
start_pfn = rtas_rmo_buf &gt;&gt; PAGE_SHIFT;<br>
end_pfn = (rtas_rmo_buf + RTAS_RMOBUF_MAX) &gt;&gt; PAGE_SHIFT;<br>
for (pfn = start_pfn; pfn &lt; end_pfn; pfn++)<br>
 &nbsp; &nbsp; &nbsp; &nbsp;SetPageReserved(page_to_pfn(pfn));<br>
<br>
-- <br>
Dave Hansen<br>
haveblue@us.ibm.com<br>
<br>
</tt>

</body></html>