On Thu, Apr 06, 2017 at 01:37:41PM -0500, Brijesh Singh wrote: > I did thought about prot idea but ran into another corner case which may require > us changing the signature of phys_pud_init and phys_pmd_init. The paddr_start > and paddr_end args into kernel_physical_mapping_init() should be aligned on PMD > level down (see comment [1]). So, if we encounter a case where our address range > is part of large page but we need to clear only one entry (i.e asked to clear just > one page into 2M region). In that case, now we need to pass additional arguments > into kernel_physical_mapping, phys_pud_init and phys_pmd_init to hint the splitting > code that it should use our prot for specific entries and all other entries will use > the old_prot. Ok, but your !4K case: + /* + * virtual address is part of large page, create the page + * table mapping to use smaller pages (4K). The virtual and + * physical address must be aligned to PMD level. + */ + kernel_physical_mapping_init(__pa(vaddr & PMD_MASK), + __pa((vaddr_end & PMD_MASK) + PMD_SIZE), + 0); would map a 2M page as encrypted by default. What if we want to map a 2M page frame as ~_PAGE_ENC? IOW, if you're adding a new interface, it should be generic enough, like with prot argument. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --