Re: [PATCH] powerpc/mm: update arch_{add,remove}_memory() for radix

From: Reza Arbab
Date: Wed Jun 29 2016 - 11:43:26 EST


On Tue, Jun 28, 2016 at 09:21:05PM +1000, Michael Ellerman wrote:
No, you need to use mmu_linear_psize for the hotplug case.

But you can probably factor out a common routine that both cases use, and hide
the hash vs radix check in that.

Okay, I'm trying to refactor {create,remove}_section_mapping() into hash__ and radix__ variants. This lead to a couple of questions.

Pseudocode for radix__create_section_mapping(start, end):

page_size = 1 << mmu_psize_defs[mmu_linear_psize].shift;
start = _ALIGN_DOWN(start, page_size);

for (; start < end; start += page_size) {
radix__map_kernel_page(start, __pa(start),
PAGE_KERNEL, page_size);
}

Should the above use PAGE_KERNEL, like the the hash table bolt, or (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_KERNEL_RW), like in the radix vmemmap creation?

The other question is what radix__remove_section_mapping() should do.
I don't know offhand what the opposite of map_kernel_page() is. As Aneesh mentioned, radix vmemmap removal is currently stubbed as a FIXME so I couldn't use that as a reference.

--
Reza Arbab