Dave Anderson wrote:
Takao Indoh wrote:

>
> However, page_to_phys returns 0x100000000. I think page_to_phys does not
> support sparsemem system.
>
>

Yeah -- the is_page_ptr() function needs to be enhanced
to support SPARSEMEM kernels...

I made a bunch of updates to the original SPARSEMEM patch
in 4.0-3.3, but missed this one.

Dave

In addition to the previous patch to dump_mem_map_SPARSEMEM(),
this update to is_page_ptr() should do the trick:

is_page_ptr(ulong addr, physaddr_t *phys)
{
        int n;
        ulong ppstart, ppend;
        struct node_table *nt;
        ulong pgnum, node_size;
+       ulong nr, sec_addr;
+       ulong nr_mem_sections;
+       ulong coded_mem_map, mem_map, end_mem_map;
+       physaddr_t section_paddr;
+
+       if (IS_SPARSEMEM()) {
+               nr_mem_sections = NR_MEM_SECTIONS();
+               for (nr = 0; nr <= nr_mem_sections ; nr++) {
+                       if ((sec_addr = valid_section_nr(nr))) {
+                               coded_mem_map = section_mem_map_addr(sec_addr);
+                               mem_map = sparse_decode_mem_map(coded_mem_map, nr);
+                               end_mem_map = mem_map + (PAGES_PER_SECTION() * SIZE(page));
+
+                               if ((addr >= mem_map) && (addr < end_mem_map)) {
+                                       if ((addr - mem_map) % SIZE(page))
+                                               return FALSE;
+                                       if (phys) {
+                                               section_paddr = PTOB(section_nr_to_pfn(nr));
+                                               pgnum = (addr - mem_map) / SIZE(page);
+                                               *phys = section_paddr + (pgnum * PAGESIZE());
+                                       }
+                                       return TRUE;
+                               }
+                       }
+               }
+               return FALSE;
+       }

        for (n = 0; n < vt->numnodes; n++) {
                nt = &vt->node_table[n];

Thanks,
  Dave